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.

3137 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. sonic_decoder_select="golomb"
  1151. sonic_encoder_select="golomb"
  1152. sonic_ls_encoder_select="golomb"
  1153. svq3_decoder_select="golomb"
  1154. svq3_decoder_suggest="zlib"
  1155. theora_decoder_select="vp3_decoder"
  1156. tiff_decoder_suggest="zlib"
  1157. tiff_encoder_suggest="zlib"
  1158. truehd_decoder_select="mlp_decoder"
  1159. tscc_decoder_select="zlib"
  1160. twinvq_decoder_select="mdct"
  1161. vc1_decoder_select="h263_decoder"
  1162. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1163. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1164. vc1_vaapi_hwaccel_deps="va_va_h"
  1165. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1166. vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1167. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1168. vorbis_decoder_select="mdct"
  1169. vorbis_encoder_select="mdct"
  1170. vp6a_decoder_select="vp6_decoder"
  1171. vp6f_decoder_select="vp6_decoder"
  1172. wmapro_decoder_select="mdct"
  1173. wmav1_decoder_select="mdct"
  1174. wmav1_encoder_select="mdct"
  1175. wmav2_decoder_select="mdct"
  1176. wmav2_encoder_select="mdct"
  1177. wmv1_decoder_select="h263_decoder"
  1178. wmv1_encoder_select="h263_encoder"
  1179. wmv2_decoder_select="h263_decoder"
  1180. wmv2_encoder_select="h263_encoder"
  1181. wmv3_decoder_select="vc1_decoder"
  1182. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1183. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1184. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1185. zlib_decoder_select="zlib"
  1186. zlib_encoder_select="zlib"
  1187. zmbv_decoder_select="zlib"
  1188. zmbv_encoder_select="zlib"
  1189. # parsers
  1190. h264_parser_select="golomb"
  1191. # bitstream_filters
  1192. aac_adtstoasc_bsf_select="aac_parser"
  1193. # external libraries
  1194. libdirac_decoder_deps="libdirac !libschroedinger"
  1195. libdirac_encoder_deps="libdirac"
  1196. libfaac_encoder_deps="libfaac"
  1197. libfaad_decoder_deps="libfaad"
  1198. libfaadbin_decoder_extralibs='$ldl'
  1199. libgsm_decoder_deps="libgsm"
  1200. libgsm_encoder_deps="libgsm"
  1201. libgsm_ms_decoder_deps="libgsm"
  1202. libgsm_ms_encoder_deps="libgsm"
  1203. libmp3lame_encoder_deps="libmp3lame"
  1204. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1205. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1206. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1207. libopenjpeg_decoder_deps="libopenjpeg"
  1208. libschroedinger_decoder_deps="libschroedinger"
  1209. libschroedinger_encoder_deps="libschroedinger"
  1210. libspeex_decoder_deps="libspeex"
  1211. libtheora_encoder_deps="libtheora"
  1212. libvorbis_encoder_deps="libvorbis"
  1213. libx264_encoder_deps="libx264"
  1214. libxvid_encoder_deps="libxvid"
  1215. # demuxers / muxers
  1216. ac3_demuxer_deps="ac3_parser"
  1217. asf_stream_muxer_select="asf_muxer"
  1218. avisynth_demuxer_deps="avisynth"
  1219. dirac_demuxer_deps="dirac_parser"
  1220. eac3_demuxer_select="ac3_parser"
  1221. ipod_muxer_select="mov_muxer"
  1222. libnut_demuxer_deps="libnut"
  1223. libnut_muxer_deps="libnut"
  1224. matroska_audio_muxer_select="matroska_muxer"
  1225. matroska_demuxer_suggest="zlib bzlib"
  1226. mov_demuxer_suggest="zlib"
  1227. mp3_demuxer_deps="mpegaudio_parser"
  1228. mp4_muxer_select="mov_muxer"
  1229. mpegtsraw_demuxer_select="mpegts_demuxer"
  1230. mxf_d10_muxer_select="mxf_muxer"
  1231. ogg_demuxer_select="golomb"
  1232. psp_muxer_select="mov_muxer"
  1233. rtsp_demuxer_deps="sdp_demuxer"
  1234. rtsp_muxer_deps="sdp_demuxer"
  1235. rtsp_muxer_select="rtp_muxer"
  1236. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1237. spdif_muxer_select="aac_parser"
  1238. tg2_muxer_select="mov_muxer"
  1239. tgp_muxer_select="mov_muxer"
  1240. w64_demuxer_deps="wav_demuxer"
  1241. # indevs / outdevs
  1242. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1243. alsa_indev_extralibs="-lasound"
  1244. alsa_outdev_deps="alsa_asoundlib_h"
  1245. alsa_outdev_extralibs="-lasound"
  1246. audio_beos_indev_deps="audio_beos"
  1247. audio_beos_indev_extralibs="-lmedia -lbe"
  1248. audio_beos_outdev_deps="audio_beos"
  1249. audio_beos_outdev_extralibs="-lmedia -lbe"
  1250. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1251. dv1394_indev_deps="dv1394 dv_demuxer"
  1252. jack_indev_deps="jack_jack_h"
  1253. jack_indev_extralibs="-ljack"
  1254. libdc1394_indev_deps="libdc1394"
  1255. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1256. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1257. v4l_indev_deps="linux_videodev_h"
  1258. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1259. vfwcap_indev_deps="capCreateCaptureWindow"
  1260. vfwcap_indev_extralibs="-lavicap32"
  1261. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1262. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1263. # protocols
  1264. gopher_protocol_deps="network"
  1265. http_protocol_deps="network"
  1266. rtmp_protocol_deps="tcp_protocol"
  1267. rtp_protocol_deps="udp_protocol"
  1268. tcp_protocol_deps="network"
  1269. udp_protocol_deps="network"
  1270. # filters
  1271. movie_filter_deps="avfilter_lavf"
  1272. avfilter_lavf_deps="avformat"
  1273. # libraries
  1274. avdevice_deps="avcodec avformat"
  1275. avformat_deps="avcodec"
  1276. # programs
  1277. ffmpeg_deps="avcodec avformat swscale"
  1278. ffplay_deps="avcodec avformat swscale sdl"
  1279. ffplay_select="rdft"
  1280. ffprobe_deps="avcodec avformat"
  1281. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1282. ffserver_extralibs='$ldl'
  1283. doc_deps="texi2html"
  1284. # default parameters
  1285. logfile="config.err"
  1286. # installation paths
  1287. prefix_default="/usr/local"
  1288. bindir_default='${prefix}/bin'
  1289. datadir_default='${prefix}/share/ffmpeg'
  1290. incdir_default='${prefix}/include'
  1291. libdir_default='${prefix}/lib'
  1292. mandir_default='${prefix}/share/man'
  1293. shlibdir_default="$libdir_default"
  1294. # toolchain
  1295. ar="ar"
  1296. cc_default="gcc"
  1297. cc_version=\"unknown\"
  1298. host_cc_default="gcc"
  1299. ln_s="ln -sf"
  1300. nm_default="nm"
  1301. objformat="elf"
  1302. ranlib="ranlib"
  1303. strip_default="strip"
  1304. yasmexe="yasm"
  1305. nm_opts='-g'
  1306. # machine
  1307. arch_default=$(uname -m)
  1308. cpu="generic"
  1309. # OS
  1310. target_os_default=$(tolower $(uname -s))
  1311. host_os=$target_os_default
  1312. # configurable options
  1313. enable avcodec
  1314. enable avdevice
  1315. enable avformat
  1316. enable avutil
  1317. enable asm
  1318. enable debug
  1319. enable doc
  1320. enable fastdiv
  1321. enable ffmpeg
  1322. enable ffplay
  1323. enable ffprobe
  1324. enable ffserver
  1325. enable mpegaudio_hp
  1326. enable network
  1327. enable optimizations
  1328. enable protocols
  1329. enable static
  1330. enable stripping
  1331. enable swscale
  1332. enable swscale_alpha
  1333. # build settings
  1334. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1335. FFSERVERLDFLAGS=-Wl,-E
  1336. LIBPREF="lib"
  1337. LIBSUF=".a"
  1338. FULLNAME='$(NAME)$(BUILDSUF)'
  1339. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1340. SLIBPREF="lib"
  1341. SLIBSUF=".so"
  1342. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1343. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1344. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1345. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1346. CC_O='-o $@'
  1347. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1348. host_libs='-lm'
  1349. target_path='$(CURDIR)'
  1350. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1351. # full relative path for objects in subdirectories for non-recursive Make.
  1352. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1353. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1354. # find source path
  1355. source_path="$(dirname "$0")"
  1356. enable source_path_used
  1357. if test -f configure; then
  1358. source_path="$(pwd)"
  1359. disable source_path_used
  1360. else
  1361. source_path="$(cd "$source_path"; pwd)"
  1362. echo "$source_path" | grep -q '[[:blank:]]' &&
  1363. die "Out of tree builds are impossible with whitespace in source path."
  1364. test -e "$source_path/config.h" &&
  1365. die "Out of tree builds are impossible with config.h in source dir."
  1366. fi
  1367. for v in "$@"; do
  1368. r=${v#*=}
  1369. l=${v%"$r"}
  1370. r=$(sh_quote "$r")
  1371. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1372. done
  1373. find_things(){
  1374. thing=$1
  1375. pattern=$2
  1376. file=$source_path/$3
  1377. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1378. }
  1379. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1380. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1381. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1382. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1383. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1384. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1385. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1386. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1387. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1388. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1389. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1390. enable $ARCH_EXT_LIST \
  1391. $DECODER_LIST \
  1392. $ENCODER_LIST \
  1393. $HWACCEL_LIST \
  1394. $PARSER_LIST \
  1395. $BSF_LIST \
  1396. $DEMUXER_LIST \
  1397. $MUXER_LIST \
  1398. $FILTER_LIST \
  1399. $PROTOCOL_LIST \
  1400. $INDEV_LIST \
  1401. $OUTDEV_LIST \
  1402. die_unknown(){
  1403. echo "Unknown option \"$1\"."
  1404. echo "See $0 --help for available options."
  1405. exit 1
  1406. }
  1407. show_list() {
  1408. suffix=_$1
  1409. shift
  1410. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1411. exit 0
  1412. }
  1413. for opt do
  1414. optval="${opt#*=}"
  1415. case "$opt" in
  1416. --extra-ldflags=*) add_ldflags $optval
  1417. ;;
  1418. --extra-libs=*) add_extralibs $optval
  1419. ;;
  1420. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1421. ;;
  1422. --enable-debug=*) debuglevel="$optval"
  1423. ;;
  1424. --enable-*=*|--disable-*=*)
  1425. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1426. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1427. eval list=\$$(toupper $thing)_LIST
  1428. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1429. $action $(filter "$name" $list)
  1430. ;;
  1431. --enable-?*|--disable-?*)
  1432. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1433. if is_in $option $COMPONENT_LIST; then
  1434. test $action = disable && action=unset
  1435. eval $action \$$(toupper ${option%s})_LIST
  1436. elif is_in $option $CMDLINE_SELECT; then
  1437. $action $option
  1438. else
  1439. die_unknown $opt
  1440. fi
  1441. ;;
  1442. --list-*)
  1443. NAME="${opt#--list-}"
  1444. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1445. NAME=${NAME%s}
  1446. eval show_list $NAME \$$(toupper $NAME)_LIST
  1447. ;;
  1448. --help|-h) show_help
  1449. ;;
  1450. *)
  1451. optname="${opt%%=*}"
  1452. optname="${optname#--}"
  1453. optname=$(echo "$optname" | sed 's/-/_/g')
  1454. if is_in $optname $CMDLINE_SET; then
  1455. eval $optname='$optval'
  1456. elif is_in $optname $CMDLINE_APPEND; then
  1457. append $optname "$optval"
  1458. else
  1459. die_unknown $opt
  1460. fi
  1461. ;;
  1462. esac
  1463. done
  1464. disabled logging && logfile=/dev/null
  1465. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1466. set >> $logfile
  1467. test -n "$cross_prefix" && enable cross_compile
  1468. if enabled cross_compile; then
  1469. test -n "$arch" && test -n "$target_os" ||
  1470. die "Must specify target arch and OS when cross-compiling"
  1471. fi
  1472. set_default arch target_os
  1473. ar="${cross_prefix}${ar}"
  1474. cc_default="${cross_prefix}${cc_default}"
  1475. nm_default="${cross_prefix}${nm_default}"
  1476. ranlib="${cross_prefix}${ranlib}"
  1477. strip_default="${cross_prefix}${strip_default}"
  1478. sysinclude_default="${sysroot}/usr/include"
  1479. set_default cc nm strip sysinclude
  1480. enabled cross_compile || host_cc_default=$cc
  1481. set_default host_cc
  1482. exesuf() {
  1483. case $1 in
  1484. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1485. esac
  1486. }
  1487. EXESUF=$(exesuf $target_os)
  1488. HOSTEXESUF=$(exesuf $host_os)
  1489. # set temporary file name
  1490. : ${TMPDIR:=$TEMPDIR}
  1491. : ${TMPDIR:=$TMP}
  1492. : ${TMPDIR:=/tmp}
  1493. if ! check_cmd type mktemp; then
  1494. # simple replacement for missing mktemp
  1495. # NOT SAFE FOR GENERAL USE
  1496. mktemp(){
  1497. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1498. }
  1499. fi
  1500. tmpfile(){
  1501. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1502. (set -C; exec > $tmp) 2>/dev/null ||
  1503. die "Unable to create temporary file in $TMPDIR."
  1504. append TMPFILES $tmp
  1505. eval $1=$tmp
  1506. }
  1507. trap 'rm -f -- $TMPFILES' EXIT
  1508. trap exit HUP INT TERM
  1509. tmpfile TMPC .c
  1510. tmpfile TMPE $EXESUF
  1511. tmpfile TMPH .h
  1512. tmpfile TMPO .o
  1513. tmpfile TMPS .S
  1514. tmpfile TMPV .ver
  1515. tmpfile TMPSH .sh
  1516. unset -f mktemp
  1517. # make sure we can execute files in $TMPDIR
  1518. cat > $TMPSH 2>> $logfile <<EOF
  1519. #! /bin/sh
  1520. EOF
  1521. chmod +x $TMPSH >> $logfile 2>&1
  1522. if ! $TMPSH >> $logfile 2>&1; then
  1523. cat <<EOF
  1524. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1525. variable to another directory and make sure that it is not mounted noexec.
  1526. EOF
  1527. die "Sanity test failed."
  1528. fi
  1529. filter_cflags=echo
  1530. filter_cppflags=echo
  1531. filter_asflags=echo
  1532. if $cc -v 2>&1 | grep -qi ^gcc; then
  1533. cc_type=gcc
  1534. cc_version=__VERSION__
  1535. if ! $cc -dumpversion | grep -q '^2\.'; then
  1536. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1537. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1538. fi
  1539. speed_cflags='-O3'
  1540. size_cflags='-Os'
  1541. elif $cc --version 2>/dev/null | grep -q Intel; then
  1542. cc_type=icc
  1543. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1544. CC_DEPFLAGS='-MMD'
  1545. AS_DEPFLAGS='-MMD'
  1546. speed_cflags='-O3'
  1547. size_cflags='-Os'
  1548. elif $cc -v 2>&1 | grep -q xlc; then
  1549. cc_type=xlc
  1550. cc_version="AV_STRINGIFY(__IBMC__)"
  1551. speed_cflags='-O5'
  1552. size_cflags='-O5 -qcompact'
  1553. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1554. cc_type=ccc
  1555. cc_version="AV_STRINGIFY(__DECC_VER)"
  1556. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1557. debuglevel=3
  1558. add_ldflags -Wl,-z,now # calls to libots crash without this
  1559. speed_cflags='-fast'
  1560. size_cflags='-O1'
  1561. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1562. test -d "$sysroot" || die "No valid sysroot specified."
  1563. cc_type=armcc
  1564. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1565. armcc_conf="$PWD/armcc.conf"
  1566. $cc --arm_linux_configure \
  1567. --arm_linux_config_file="$armcc_conf" \
  1568. --configure_sysroot="$sysroot" \
  1569. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1570. die "Error creating armcc configuration file."
  1571. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1572. as_default="${cross_prefix}gcc"
  1573. CC_DEPFLAGS='-MMD'
  1574. AS_DEPFLAGS='-MMD'
  1575. speed_cflags='-O3'
  1576. size_cflags='-Os'
  1577. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1578. cc_type=tms470
  1579. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1580. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1581. CC_O='-fr=$(@D)'
  1582. as_default="${cross_prefix}gcc"
  1583. ld_default="${cross_prefix}gcc"
  1584. TMPO=$(basename $TMPC .c).o
  1585. append TMPFILES $TMPO
  1586. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1587. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1588. AS_DEPFLAGS='-MMD'
  1589. speed_cflags='-O3 -mf=5'
  1590. size_cflags='-O3 -mf=2'
  1591. filter_cflags=tms470_flags
  1592. tms470_flags(){
  1593. for flag; do
  1594. case $flag in
  1595. -march=*|-mcpu=*)
  1596. case "${flag#*=}" in
  1597. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1598. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1599. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1600. armv6*|arm11*) echo -mv=6 ;;
  1601. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1602. echo -mv=5e ;;
  1603. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1604. esac
  1605. ;;
  1606. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1607. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1608. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1609. -msoft-float) echo --float_support=vfplib ;;
  1610. -O[0-3]|-mf=*) echo $flag ;;
  1611. -g) echo -g -mn ;;
  1612. -pds=*) echo $flag ;;
  1613. esac
  1614. done
  1615. }
  1616. elif $cc -v 2>&1 | grep -q clang; then
  1617. cc_type=clang
  1618. cc_version=__VERSION__
  1619. CC_DEPFLAGS='-MMD'
  1620. AS_DEPFLAGS='-MMD'
  1621. speed_cflags='-O3'
  1622. size_cflags='-Os'
  1623. elif $cc -V 2>&1 | grep -q Sun; then
  1624. cc_type=suncc
  1625. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1626. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1627. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1628. speed_cflags='-O5'
  1629. size_cflags='-O5 -xspace'
  1630. filter_cflags=suncc_flags
  1631. suncc_flags(){
  1632. for flag; do
  1633. case $flag in
  1634. -march=*|-mcpu=*)
  1635. case "${flag#*=}" in
  1636. native) echo -xtarget=native ;;
  1637. v9) echo -xarch=sparc ;;
  1638. ultrasparc) echo -xarch=sparcvis ;;
  1639. ultrasparc3|niagara*) echo -xarch=sparcvis2 ;;
  1640. i586|pentium) echo -xchip=pentium ;;
  1641. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1642. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1643. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1644. pentium4*) echo -xtarget=pentium4 ;;
  1645. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1646. *-sse3) echo -xarch=sse3 ;;
  1647. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1648. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1649. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1650. k8|opteron|athlon64|athlon-fx)
  1651. echo -xarch=sse2a ;;
  1652. athlon*) echo -xarch=pentium_proa ;;
  1653. esac
  1654. ;;
  1655. -std=c99) echo -xc99 ;;
  1656. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1657. -fPIC) echo -KPIC -xcode=pic32 ;;
  1658. -W*,*) echo $flag ;;
  1659. -f*-*|-W*) ;;
  1660. *) echo $flag ;;
  1661. esac
  1662. done
  1663. }
  1664. fi
  1665. test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1666. : ${as_default:=$cc}
  1667. : ${dep_cc_default:=$cc}
  1668. : ${ld_default:=$cc}
  1669. set_default as dep_cc ld
  1670. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1671. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1672. add_cflags $extra_cflags
  1673. add_asflags $extra_cflags
  1674. if test -n "$sysroot"; then
  1675. case "$cc_type" in
  1676. gcc)
  1677. add_cppflags --sysroot="$sysroot"
  1678. add_ldflags --sysroot="$sysroot"
  1679. ;;
  1680. tms470)
  1681. add_cppflags -I"$sysinclude"
  1682. add_ldflags --sysroot="$sysroot"
  1683. ;;
  1684. clang)
  1685. add_cppflags -isysroot="$sysroot"
  1686. add_ldflags -isysroot="$sysroot"
  1687. ;;
  1688. esac
  1689. fi
  1690. if test "$cpu" = host; then
  1691. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1692. case "$cc_type" in
  1693. gcc)
  1694. check_native(){
  1695. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1696. sed -n "/$1=/{
  1697. s/.*$1=\\([^ ]*\\).*/\\1/
  1698. p
  1699. q
  1700. }" $TMPE
  1701. }
  1702. cpu=$(check_native -march || check_native -mcpu)
  1703. ;;
  1704. esac
  1705. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1706. fi
  1707. # Deal with common $arch aliases
  1708. case "$arch" in
  1709. arm*)
  1710. arch="arm"
  1711. ;;
  1712. mips|mipsel|IP*)
  1713. arch="mips"
  1714. ;;
  1715. mips64)
  1716. arch="mips"
  1717. subarch="mips64"
  1718. ;;
  1719. parisc|hppa)
  1720. arch="parisc"
  1721. ;;
  1722. parisc64|hppa64)
  1723. arch="parisc"
  1724. subarch="parisc64"
  1725. ;;
  1726. "Power Macintosh"|ppc|powerpc)
  1727. arch="ppc"
  1728. ;;
  1729. ppc64)
  1730. arch="ppc"
  1731. subarch="ppc64"
  1732. ;;
  1733. s390|s390x)
  1734. arch="s390"
  1735. ;;
  1736. sh4|sh)
  1737. arch="sh4"
  1738. ;;
  1739. sun4u|sparc64)
  1740. arch="sparc"
  1741. subarch="sparc64"
  1742. ;;
  1743. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1744. arch="x86"
  1745. ;;
  1746. esac
  1747. is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
  1748. enable $arch
  1749. # Add processor-specific flags
  1750. if test "$cpu" = generic; then
  1751. : do nothing
  1752. elif enabled ppc; then
  1753. case $(tolower $cpu) in
  1754. 601|ppc601|powerpc601)
  1755. cpuflags="-mcpu=601"
  1756. disable altivec
  1757. ;;
  1758. 603*|ppc603*|powerpc603*)
  1759. cpuflags="-mcpu=603"
  1760. disable altivec
  1761. ;;
  1762. 604*|ppc604*|powerpc604*)
  1763. cpuflags="-mcpu=604"
  1764. disable altivec
  1765. ;;
  1766. g3|75*|ppc75*|powerpc75*)
  1767. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1768. disable altivec
  1769. ;;
  1770. g4|745*|ppc745*|powerpc745*)
  1771. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1772. ;;
  1773. 74*|ppc74*|powerpc74*)
  1774. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1775. ;;
  1776. g5|970|ppc970|powerpc970|power4*)
  1777. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1778. ;;
  1779. cell)
  1780. cpuflags="-mcpu=cell"
  1781. enable ldbrx
  1782. ;;
  1783. e500v2)
  1784. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1785. disable altivec
  1786. ;;
  1787. e500)
  1788. cpuflags="-mcpu=8540 -mhard-float"
  1789. disable altivec
  1790. ;;
  1791. esac
  1792. elif enabled x86; then
  1793. case $cpu in
  1794. i[345]86|pentium)
  1795. cpuflags="-march=$cpu"
  1796. disable mmx
  1797. ;;
  1798. # targets that do NOT support conditional mov (cmov)
  1799. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1800. cpuflags="-march=$cpu"
  1801. disable cmov
  1802. ;;
  1803. # targets that do support conditional mov (cmov)
  1804. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
  1805. cpuflags="-march=$cpu"
  1806. enable cmov
  1807. enable fast_cmov
  1808. ;;
  1809. # targets that do support conditional mov but on which it's slow
  1810. pentium4|pentium4m|prescott|nocona)
  1811. cpuflags="-march=$cpu"
  1812. enable cmov
  1813. disable fast_cmov
  1814. ;;
  1815. esac
  1816. elif enabled sparc; then
  1817. case $cpu in
  1818. sparc64)
  1819. cpuflags="-mcpu=v9"
  1820. ;;
  1821. esac
  1822. elif enabled arm; then
  1823. case $cpu in
  1824. armv*)
  1825. cpuflags="-march=$cpu"
  1826. ;;
  1827. *)
  1828. cpuflags="-mcpu=$cpu"
  1829. ;;
  1830. esac
  1831. elif enabled alpha; then
  1832. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  1833. elif enabled bfin; then
  1834. cpuflags="-mcpu=$cpu"
  1835. elif enabled mips; then
  1836. cpuflags="-march=$cpu"
  1837. elif enabled avr32; then
  1838. case $cpu in
  1839. ap7[02]0[0-2])
  1840. subarch="avr32_ap"
  1841. cpuflags="-mpart=$cpu"
  1842. ;;
  1843. ap)
  1844. subarch="avr32_ap"
  1845. cpuflags="-march=$cpu"
  1846. ;;
  1847. uc3[ab]*)
  1848. subarch="avr32_uc"
  1849. cpuflags="-mcpu=$cpu"
  1850. ;;
  1851. uc)
  1852. subarch="avr32_uc"
  1853. cpuflags="-march=$cpu"
  1854. ;;
  1855. esac
  1856. fi
  1857. add_cflags $cpuflags
  1858. add_asflags $cpuflags
  1859. # compiler sanity check
  1860. check_exec <<EOF
  1861. int main(void){ return 0; }
  1862. EOF
  1863. if test "$?" != 0; then
  1864. echo "$cc is unable to create an executable file."
  1865. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1866. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1867. echo "Only do this if you know what cross compiling means."
  1868. fi
  1869. die "C compiler test failed."
  1870. fi
  1871. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1872. check_cflags -std=c99
  1873. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  1874. #include <stdlib.h>
  1875. EOF
  1876. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  1877. #include <stdlib.h>
  1878. EOF
  1879. check_host_cflags -std=c99
  1880. case "$arch" in
  1881. alpha|ia64|mips|parisc|sparc)
  1882. spic=$shared
  1883. ;;
  1884. x86)
  1885. subarch="x86_32"
  1886. check_cc <<EOF && subarch="x86_64"
  1887. int test[(int)sizeof(char*) - 7];
  1888. EOF
  1889. if test "$subarch" = "x86_64"; then
  1890. spic=$shared
  1891. fi
  1892. ;;
  1893. esac
  1894. enable $subarch
  1895. enabled spic && enable pic
  1896. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  1897. # OS specific
  1898. case $target_os in
  1899. beos|haiku|zeta)
  1900. prefix_default="$HOME/config"
  1901. # 3 gcc releases known for BeOS, each with ugly bugs
  1902. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1903. case "$gcc_version" in
  1904. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1905. disable mmx
  1906. ;;
  1907. *20010315*) echo "BeBits gcc"
  1908. add_cflags -fno-expensive-optimizations
  1909. ;;
  1910. esac
  1911. SHFLAGS=-nostart
  1912. # enable BeOS things
  1913. enable audio_beos
  1914. # no need for libm, but the inet stuff
  1915. # Check for BONE
  1916. # XXX: actually should check for NOT net_server
  1917. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1918. network_extralibs="-lbind -lsocket"
  1919. else
  1920. enable beos_netserver
  1921. network_extralibs="-lnet"
  1922. fi ;;
  1923. sunos)
  1924. FFSERVERLDFLAGS=""
  1925. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1926. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1927. network_extralibs="-lsocket -lnsl"
  1928. add_cppflags -D__EXTENSIONS__
  1929. nm_opts='-P -g'
  1930. ;;
  1931. netbsd)
  1932. oss_indev_extralibs="-lossaudio"
  1933. oss_outdev_extralibs="-lossaudio"
  1934. ;;
  1935. openbsd)
  1936. enable malloc_aligned
  1937. # On OpenBSD 4.5. the compiler does not use PIC unless
  1938. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  1939. # however the generated executable will not do anything
  1940. # (simply quits with exit-code 1, no crash, no output).
  1941. # Thus explicitly enable PIC here.
  1942. enable pic
  1943. SHFLAGS='-shared'
  1944. oss_indev_extralibs="-lossaudio"
  1945. oss_outdev_extralibs="-lossaudio"
  1946. ;;
  1947. freebsd|dragonfly)
  1948. enable malloc_aligned
  1949. ;;
  1950. bsd/os)
  1951. osextralibs="-lpoll -lgnugetopt"
  1952. strip="strip -d"
  1953. ;;
  1954. darwin)
  1955. enable malloc_aligned
  1956. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1957. strip="strip -x"
  1958. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1959. SLIBSUF=".dylib"
  1960. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1961. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1962. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1963. objformat="macho"
  1964. enabled x86_64 && objformat="macho64"
  1965. enabled_any pic shared ||
  1966. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  1967. ;;
  1968. mingw32*)
  1969. if test $target_os = "mingw32ce"; then
  1970. disable network
  1971. else
  1972. target_os=mingw32
  1973. fi
  1974. LIBTARGET=i386
  1975. if enabled x86_64; then
  1976. enable malloc_aligned
  1977. LIBTARGET=x64
  1978. elif enabled arm; then
  1979. LIBTARGET=arm
  1980. fi
  1981. shlibdir_default="$bindir_default"
  1982. disable ffserver
  1983. SLIBPREF=""
  1984. SLIBSUF=".dll"
  1985. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1986. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1987. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1988. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1989. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  1990. install -d "$(LIBDIR)"; \
  1991. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  1992. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1993. 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'
  1994. objformat="win32"
  1995. enable dos_paths
  1996. check_cflags -fno-common
  1997. if ! enabled x86_64; then
  1998. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1999. die "ERROR: MinGW runtime version must be >= 3.15."
  2000. enabled_any avisynth vfwcap_indev &&
  2001. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  2002. die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
  2003. fi
  2004. ;;
  2005. cygwin*)
  2006. target_os=cygwin
  2007. shlibdir_default="$bindir_default"
  2008. SLIBPREF="cyg"
  2009. SLIBSUF=".dll"
  2010. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2011. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2012. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2013. objformat="win32"
  2014. enable dos_paths
  2015. check_cflags -fno-common
  2016. ;;
  2017. *-dos|freedos|opendos)
  2018. disable ffplay ffserver
  2019. disable $INDEV_LIST $OUTDEV_LIST
  2020. network_extralibs="-lsocket"
  2021. objformat="coff"
  2022. enable dos_paths
  2023. ;;
  2024. linux)
  2025. enable dv1394
  2026. ;;
  2027. irix*)
  2028. target_os=irix
  2029. ranlib="echo ignoring ranlib"
  2030. ;;
  2031. os/2*)
  2032. strip="lxlite"
  2033. ln_s="cp -f"
  2034. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  2035. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2036. FFSERVERLDFLAGS=""
  2037. LIBSUF="_s.a"
  2038. SLIBPREF=""
  2039. SLIBSUF=".dll"
  2040. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2041. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2042. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2043. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2044. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2045. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2046. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2047. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2048. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2049. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2050. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2051. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2052. enable dos_paths
  2053. ;;
  2054. gnu/kfreebsd)
  2055. ;;
  2056. gnu)
  2057. ;;
  2058. none)
  2059. ;;
  2060. *)
  2061. die "Unknown OS '$target_os'."
  2062. ;;
  2063. esac
  2064. set_default $PATHS_LIST
  2065. add_extralibs $osextralibs
  2066. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  2067. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  2068. # we need to build at least one lib type
  2069. if ! enabled_any static shared; then
  2070. cat <<EOF
  2071. At least one library type must be built.
  2072. Specify --enable-static to build the static libraries or --enable-shared to
  2073. build the shared libraries as well. To only build the shared libraries specify
  2074. --disable-static in addition to --enable-shared.
  2075. EOF
  2076. exit 1;
  2077. fi
  2078. disabled static && LIBNAME=""
  2079. if enabled_any libfaad libfaadbin ; then
  2080. if check_header faad.h; then
  2081. check_cc <<EOF
  2082. #include <faad.h>
  2083. #ifndef FAAD2_VERSION
  2084. ok faad1
  2085. #endif
  2086. int main(void) { return 0; }
  2087. EOF
  2088. test $? = 0 && enable libfaad2
  2089. else
  2090. die "FAAD test failed."
  2091. fi
  2092. fi
  2093. die_license_disabled() {
  2094. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2095. }
  2096. die_license_disabled gpl libfaad2
  2097. die_license_disabled gpl libx264
  2098. die_license_disabled gpl libxvid
  2099. die_license_disabled gpl postproc
  2100. die_license_disabled gpl x11grab
  2101. die_license_disabled nonfree libfaac
  2102. die_license_disabled version3 libopencore_amrnb
  2103. die_license_disabled version3 libopencore_amrwb
  2104. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2105. check_deps $ARCH_EXT_LIST
  2106. disabled optimizations || check_cflags -fomit-frame-pointer
  2107. enable_pic() {
  2108. enable pic
  2109. add_cppflags -DPIC
  2110. add_cflags -fPIC
  2111. add_asflags -fPIC
  2112. }
  2113. enabled pic && enable_pic
  2114. check_cc <<EOF || die "Symbol mangling check failed."
  2115. int ff_extern;
  2116. EOF
  2117. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2118. extern_prefix=${sym%%ff_extern*}
  2119. check_cc <<EOF && enable inline_asm
  2120. void foo(void) { __asm__ volatile ("" ::); }
  2121. EOF
  2122. _restrict=
  2123. for restrict_keyword in restrict __restrict__ __restrict; do
  2124. check_cc <<EOF && _restrict=$restrict_keyword && break
  2125. void foo(char * $restrict_keyword p);
  2126. EOF
  2127. done
  2128. check_cc <<EOF && enable attribute_packed
  2129. struct { int x; } __attribute__((packed)) x;
  2130. EOF
  2131. check_cc <<EOF && enable attribute_may_alias
  2132. union { int x; } __attribute__((may_alias)) x;
  2133. EOF
  2134. check_cc <<EOF || die "endian test failed"
  2135. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2136. EOF
  2137. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2138. if enabled alpha; then
  2139. check_cflags -mieee
  2140. elif enabled arm; then
  2141. check_cflags -marm
  2142. check_ld <<EOF && enable vfp_args
  2143. __asm__ (".eabi_attribute 28, 1");
  2144. int main(void) { return 0; }
  2145. EOF
  2146. # We have to check if pld is a nop and disable it.
  2147. check_asm pld '"pld [r0]"'
  2148. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2149. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2150. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2151. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2152. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2153. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2154. enabled_all armv6t2 shared !pic && enable_pic
  2155. elif enabled ia64; then
  2156. # HACK: currently fails to build if .bss is > 4MB and shared libs are built
  2157. enabled shared && enable_weak hardcoded_tables
  2158. elif enabled mips; then
  2159. check_asm loongson '"dmult.g $1, $2, $3"'
  2160. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2161. elif enabled ppc; then
  2162. enable local_aligned_8 local_aligned_16
  2163. check_asm dcbzl '"dcbzl 0, 1"'
  2164. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2165. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2166. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2167. if enabled altivec; then
  2168. check_cflags -maltivec -mabi=altivec &&
  2169. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2170. check_cflags -faltivec
  2171. # check if our compiler supports Motorola AltiVec C API
  2172. check_cc <<EOF || disable altivec
  2173. $inc_altivec_h
  2174. int main(void) {
  2175. vector signed int v1, v2, v3;
  2176. v1 = vec_add(v2,v3);
  2177. return 0;
  2178. }
  2179. EOF
  2180. # check if our compiler supports braces for vector declarations
  2181. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2182. $inc_altivec_h
  2183. int main (void) { (vector int) {1}; return 0; }
  2184. EOF
  2185. fi
  2186. elif enabled sparc; then
  2187. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2188. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2189. elif enabled x86; then
  2190. enable local_aligned_8 local_aligned_16
  2191. # check whether EBP is available on x86
  2192. # As 'i' is stored on the stack, this program will crash
  2193. # if the base pointer is used to access it because the
  2194. # base pointer is cleared in the inline assembly code.
  2195. check_exec_crash <<EOF && enable ebp_available
  2196. volatile int i=0;
  2197. __asm__ volatile (
  2198. "xorl %%ebp, %%ebp"
  2199. ::: "%ebp");
  2200. return i;
  2201. EOF
  2202. # check whether EBX is available on x86
  2203. check_asm ebx_available '""::"b"(0)' &&
  2204. check_asm ebx_available '"":::"%ebx"'
  2205. # check whether more than 10 operands are supported
  2206. check_cc <<EOF && enable ten_operands
  2207. int main(void) {
  2208. int x=0;
  2209. __asm__ volatile(
  2210. ""
  2211. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2212. );
  2213. return 0;
  2214. }
  2215. EOF
  2216. # check whether binutils is new enough to compile SSSE3/MMX2
  2217. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2218. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2219. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2220. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  2221. enabled x86_64 && append YASMFLAGS "-m amd64"
  2222. enabled pic && append YASMFLAGS "-DPIC"
  2223. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2224. case "$objformat" in
  2225. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  2226. esac
  2227. disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  2228. case "$cpu" in
  2229. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2230. disable fast_clz
  2231. ;;
  2232. esac
  2233. fi
  2234. if check_func dlopen; then
  2235. ldl=
  2236. elif check_func dlopen -ldl; then
  2237. ldl=-ldl
  2238. fi
  2239. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2240. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2241. check_func fork
  2242. check_func getaddrinfo $network_extralibs
  2243. check_func gethrtime
  2244. check_func getrusage
  2245. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2246. check_func inet_aton $network_extralibs
  2247. check_func isatty
  2248. check_func ${malloc_prefix}memalign && enable memalign
  2249. check_func mkstemp
  2250. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2251. check_func setrlimit
  2252. check_func_headers io.h setmode
  2253. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2254. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2255. check_func_headers windows.h GetProcessTimes
  2256. check_func_headers windows.h VirtualAlloc
  2257. check_header conio.h
  2258. check_header dlfcn.h
  2259. check_header dxva2api.h
  2260. check_header malloc.h
  2261. check_header poll.h
  2262. check_header sys/mman.h
  2263. check_header sys/resource.h
  2264. check_header sys/select.h
  2265. check_header termios.h
  2266. check_header vdpau/vdpau.h
  2267. check_header vdpau/vdpau_x11.h
  2268. check_header X11/extensions/XvMClib.h
  2269. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2270. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2271. enabled_any $need_memalign ; then
  2272. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2273. fi
  2274. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2275. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2276. # check for some common methods of building with pthread support
  2277. # do this before the optional library checks as some of them require pthreads
  2278. if enabled pthreads; then
  2279. if check_func pthread_create; then
  2280. :
  2281. elif check_func pthread_create -pthread; then
  2282. add_cflags -pthread
  2283. add_extralibs -pthread
  2284. elif check_func pthread_create -pthreads; then
  2285. add_cflags -pthreads
  2286. add_extralibs -pthreads
  2287. elif check_func pthread_create -lpthreadGC2; then
  2288. add_extralibs -lpthreadGC2
  2289. elif ! check_lib pthread.h pthread_create -lpthread; then
  2290. die "ERROR: can't find pthreads library"
  2291. fi
  2292. fi
  2293. for thread in $THREADS_LIST; do
  2294. if enabled $thread; then
  2295. test -n "$thread_type" &&
  2296. die "ERROR: Only one thread type must be selected." ||
  2297. thread_type="$thread"
  2298. fi
  2299. done
  2300. check_lib math.h sin -lm
  2301. check_lib va/va.h vaInitialize -lva
  2302. check_mathfunc exp2
  2303. check_mathfunc exp2f
  2304. check_mathfunc llrint
  2305. check_mathfunc log2
  2306. check_mathfunc log2f
  2307. check_mathfunc lrint
  2308. check_mathfunc lrintf
  2309. check_mathfunc round
  2310. check_mathfunc roundf
  2311. check_mathfunc truncf
  2312. # these are off by default, so fail if requested and not available
  2313. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2314. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2315. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2316. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2317. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2318. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  2319. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2320. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  2321. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2322. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
  2323. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
  2324. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2325. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2326. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2327. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2328. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2329. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2330. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
  2331. { check_cpp_condition x264.h "X264_BUILD >= 83" ||
  2332. die "ERROR: libx264 version must be >= 0.83."; }
  2333. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2334. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2335. # libdc1394 check
  2336. if enabled libdc1394; then
  2337. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2338. enable libdc1394_2; } ||
  2339. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2340. enable libdc1394_1; } ||
  2341. die "ERROR: No version of libdc1394 found "
  2342. fi
  2343. SDL_CONFIG="${cross_prefix}sdl-config"
  2344. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2345. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2346. sdl_libs=$("${SDL_CONFIG}" --libs)
  2347. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2348. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2349. enable sdl &&
  2350. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2351. fi
  2352. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2353. if enabled network; then
  2354. check_type "sys/types.h sys/socket.h" socklen_t
  2355. check_type netdb.h "struct addrinfo"
  2356. check_type netinet/in.h "struct ipv6_mreq"
  2357. check_type netinet/in.h "struct sockaddr_in6"
  2358. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2359. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2360. # Prefer arpa/inet.h over winsock2
  2361. if check_header arpa/inet.h ; then
  2362. check_func closesocket
  2363. elif check_header winsock2.h ; then
  2364. check_func_headers winsock2.h closesocket -lws2 && \
  2365. network_extralibs="-lws2" || \
  2366. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2367. network_extralibs="-lws2_32"; }
  2368. check_type ws2tcpip.h socklen_t
  2369. check_type ws2tcpip.h "struct addrinfo"
  2370. check_type ws2tcpip.h "struct ipv6_mreq"
  2371. check_type ws2tcpip.h "struct sockaddr_in6"
  2372. check_type ws2tcpip.h "struct sockaddr_storage"
  2373. check_struct winsock2.h "struct sockaddr" sa_len
  2374. else
  2375. disable network
  2376. fi
  2377. fi
  2378. check_header linux/videodev.h
  2379. check_header linux/videodev2.h
  2380. check_header sys/videoio.h
  2381. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2382. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2383. { check_header dev/bktr/ioctl_meteor.h &&
  2384. check_header dev/bktr/ioctl_bt848.h; } ||
  2385. { check_header machine/ioctl_meteor.h &&
  2386. check_header machine/ioctl_bt848.h; } ||
  2387. { check_header dev/video/meteor/ioctl_meteor.h &&
  2388. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2389. check_header dev/ic/bt8xx.h
  2390. check_header sys/soundcard.h
  2391. check_header soundcard.h
  2392. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2393. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2394. enabled x11grab &&
  2395. check_header X11/Xlib.h &&
  2396. check_header X11/extensions/XShm.h &&
  2397. check_header X11/extensions/Xfixes.h &&
  2398. check_func XOpenDisplay -lX11 &&
  2399. check_func XShmCreateImage -lX11 -lXext &&
  2400. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2401. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2402. check_cpp_condition \
  2403. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2404. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2405. disable vdpau; }
  2406. fi
  2407. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2408. # add some useful compiler flags if supported
  2409. check_cflags -Wdeclaration-after-statement
  2410. check_cflags -Wall
  2411. check_cflags -Wno-switch
  2412. check_cflags -Wdisabled-optimization
  2413. check_cflags -Wpointer-arith
  2414. check_cflags -Wredundant-decls
  2415. check_cflags -Wno-pointer-sign
  2416. check_cflags -Wcast-qual
  2417. check_cflags -Wwrite-strings
  2418. check_cflags -Wtype-limits
  2419. check_cflags -Wundef
  2420. enabled extra_warnings && check_cflags -Winline
  2421. # add some linker flags
  2422. check_ldflags -Wl,--warn-common
  2423. check_ldflags -Wl,--as-needed
  2424. 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'
  2425. check_ldflags -Wl,-Bsymbolic
  2426. echo "X{};" > $TMPV
  2427. test_ldflags -Wl,--version-script,$TMPV &&
  2428. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2429. if enabled small; then
  2430. add_cflags $size_cflags
  2431. optimizations="small"
  2432. elif enabled optimizations; then
  2433. add_cflags $speed_cflags
  2434. fi
  2435. check_cflags -fno-math-errno
  2436. check_cflags -fno-signed-zeros
  2437. if enabled icc; then
  2438. # Just warnings, no remarks
  2439. check_cflags -w1
  2440. # -wd: Disable following warnings
  2441. # 144, 167, 556: -Wno-pointer-sign
  2442. # 10006: ignoring unknown option -fno-signed-zeros
  2443. # 10156: ignoring option '-W'; no argument required
  2444. check_cflags -wd144,167,556,10006,10156
  2445. # 11030: Warning unknown option --as-needed
  2446. # 10156: ignoring option '-export'; no argument required
  2447. check_ldflags -wd10156,11030
  2448. # Allow to compile with optimizations
  2449. check_ldflags -march=$cpu
  2450. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2451. enable ebp_available
  2452. elif enabled ccc; then
  2453. # disable some annoying warnings
  2454. add_cflags -msg_disable cvtu32to64
  2455. add_cflags -msg_disable embedcomment
  2456. add_cflags -msg_disable needconstext
  2457. add_cflags -msg_disable nomainieee
  2458. add_cflags -msg_disable ptrmismatch1
  2459. add_cflags -msg_disable unreachcode
  2460. elif enabled gcc; then
  2461. check_cflags -fno-tree-vectorize
  2462. elif enabled clang; then
  2463. check_cflags -Qunused-arguments
  2464. elif enabled armcc; then
  2465. # 2523: use of inline assembler is deprecated
  2466. add_cflags -Wrvct,--diag_suppress=2523
  2467. add_cflags -Wrvct,--diag_suppress=1207
  2468. elif enabled tms470; then
  2469. add_cflags -pds=824 -pds=837
  2470. fi
  2471. if enabled gprof; then
  2472. add_cflags -p
  2473. add_ldflags -p
  2474. fi
  2475. # Find out if the .align argument is a power of two or not.
  2476. check_asm asmalign_pot '".align 3"'
  2477. enabled_any $DECODER_LIST && enable decoders
  2478. enabled_any $ENCODER_LIST && enable encoders
  2479. enabled_any $HWACCEL_LIST && enable hwaccels
  2480. enabled_any $BSF_LIST && enable bsfs
  2481. enabled_any $DEMUXER_LIST && enable demuxers
  2482. enabled_any $MUXER_LIST && enable muxers
  2483. enabled_any $FILTER_LIST && enable filters
  2484. enabled_any $INDEV_LIST && enable indevs
  2485. enabled_any $OUTDEV_LIST && enable outdevs
  2486. enabled_any $PROTOCOL_LIST && enable protocols
  2487. enabled_any $THREADS_LIST && enable threads
  2488. check_deps $CONFIG_LIST \
  2489. $CONFIG_EXTRA \
  2490. $HAVE_LIST \
  2491. $DECODER_LIST \
  2492. $ENCODER_LIST \
  2493. $HWACCEL_LIST \
  2494. $PARSER_LIST \
  2495. $BSF_LIST \
  2496. $DEMUXER_LIST \
  2497. $MUXER_LIST \
  2498. $FILTER_LIST \
  2499. $INDEV_LIST \
  2500. $OUTDEV_LIST \
  2501. $PROTOCOL_LIST \
  2502. enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
  2503. echo "install prefix $prefix"
  2504. echo "source path $source_path"
  2505. echo "C compiler $cc"
  2506. echo ".align is power-of-two $asmalign_pot"
  2507. echo "ARCH $arch ($cpu)"
  2508. if test "$build_suffix" != ""; then
  2509. echo "build suffix $build_suffix"
  2510. fi
  2511. if test "$extra_version" != ""; then
  2512. echo "version string suffix $extra_version"
  2513. fi
  2514. echo "big-endian ${bigendian-no}"
  2515. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2516. if enabled x86; then
  2517. echo "yasm ${yasm-no}"
  2518. echo "MMX enabled ${mmx-no}"
  2519. echo "MMX2 enabled ${mmx2-no}"
  2520. echo "3DNow! enabled ${amd3dnow-no}"
  2521. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2522. echo "SSE enabled ${sse-no}"
  2523. echo "SSSE3 enabled ${ssse3-no}"
  2524. echo "CMOV enabled ${cmov-no}"
  2525. echo "CMOV is fast ${fast_cmov-no}"
  2526. echo "EBX available ${ebx_available-no}"
  2527. echo "EBP available ${ebp_available-no}"
  2528. echo "10 operands supported ${ten_operands-no}"
  2529. fi
  2530. if enabled arm; then
  2531. echo "ARMv5TE enabled ${armv5te-no}"
  2532. echo "ARMv6 enabled ${armv6-no}"
  2533. echo "ARMv6T2 enabled ${armv6t2-no}"
  2534. echo "ARM VFP enabled ${armvfp-no}"
  2535. echo "IWMMXT enabled ${iwmmxt-no}"
  2536. echo "NEON enabled ${neon-no}"
  2537. fi
  2538. if enabled mips; then
  2539. echo "MMI enabled ${mmi-no}"
  2540. fi
  2541. if enabled ppc; then
  2542. echo "AltiVec enabled ${altivec-no}"
  2543. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2544. echo "dcbzl available ${dcbzl-no}"
  2545. echo "performance report ${powerpc_perf-no}"
  2546. fi
  2547. if enabled sparc; then
  2548. echo "VIS enabled ${vis-no}"
  2549. fi
  2550. echo "gprof enabled ${gprof-no}"
  2551. echo "debug symbols ${debug-no}"
  2552. echo "strip symbols ${stripping-no}"
  2553. echo "optimizations ${optimizations-no}"
  2554. echo "static ${static-no}"
  2555. echo "shared ${shared-no}"
  2556. echo "postprocessing support ${postproc-no}"
  2557. echo "new filter support ${avfilter-no}"
  2558. echo "filters using lavformat ${avfilter_lavf-no}"
  2559. echo "network support ${network-no}"
  2560. echo "threading support ${thread_type-no}"
  2561. echo "SDL support ${sdl-no}"
  2562. echo "Sun medialib support ${mlib-no}"
  2563. echo "AVISynth enabled ${avisynth-no}"
  2564. echo "libdc1394 support ${libdc1394-no}"
  2565. echo "libdirac enabled ${libdirac-no}"
  2566. echo "libfaac enabled ${libfaac-no}"
  2567. echo "libfaad enabled ${libfaad-no}"
  2568. echo "libfaad dlopened ${libfaadbin-no}"
  2569. echo "libgsm enabled ${libgsm-no}"
  2570. echo "libmp3lame enabled ${libmp3lame-no}"
  2571. echo "libnut enabled ${libnut-no}"
  2572. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2573. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2574. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2575. echo "libschroedinger enabled ${libschroedinger-no}"
  2576. echo "libspeex enabled ${libspeex-no}"
  2577. echo "libtheora enabled ${libtheora-no}"
  2578. echo "libvorbis enabled ${libvorbis-no}"
  2579. echo "libx264 enabled ${libx264-no}"
  2580. echo "libxvid enabled ${libxvid-no}"
  2581. echo "zlib enabled ${zlib-no}"
  2582. echo "bzlib enabled ${bzlib-no}"
  2583. echo
  2584. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2585. echo "Enabled ${type}s:"
  2586. eval list=\$$(toupper $type)_LIST
  2587. for part in $list; do
  2588. enabled $part && echo ${part%_*}
  2589. done | sort | pr -3 -t
  2590. echo
  2591. done
  2592. license="LGPL version 2.1 or later"
  2593. if enabled nonfree; then
  2594. license="nonfree and unredistributable"
  2595. elif enabled gplv3; then
  2596. license="GPL version 3 or later"
  2597. elif enabled lgplv3; then
  2598. license="LGPL version 3 or later"
  2599. elif enabled gpl; then
  2600. license="GPL version 2 or later"
  2601. fi
  2602. echo "License: $license"
  2603. echo "Creating config.mak and config.h..."
  2604. # build tree in object directory if source path is different from current one
  2605. if enabled source_path_used; then
  2606. DIRS="
  2607. doc
  2608. libavcodec
  2609. libavcodec/$arch
  2610. libavdevice
  2611. libavfilter
  2612. libavformat
  2613. libavutil
  2614. libavutil/$arch
  2615. libpostproc
  2616. libswscale
  2617. libswscale/$arch
  2618. tests
  2619. tools
  2620. "
  2621. FILES="
  2622. Makefile
  2623. common.mak
  2624. subdir.mak
  2625. doc/texi2pod.pl
  2626. libavcodec/Makefile
  2627. libavdevice/Makefile
  2628. libavfilter/Makefile
  2629. libavformat/Makefile
  2630. libavutil/Makefile
  2631. libpostproc/Makefile
  2632. libswscale/Makefile
  2633. "
  2634. for dir in $DIRS ; do
  2635. mkdir -p $dir
  2636. done
  2637. for f in $FILES ; do
  2638. $ln_s "$source_path/$f" $f
  2639. done
  2640. fi
  2641. enabled stripping || strip="echo skipping strip"
  2642. cat > config.mak <<EOF
  2643. # Automatically generated by configure - do not modify!
  2644. ifndef FFMPEG_CONFIG_MAK
  2645. FFMPEG_CONFIG_MAK=1
  2646. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2647. prefix=$prefix
  2648. LIBDIR=\$(DESTDIR)$libdir
  2649. SHLIBDIR=\$(DESTDIR)$shlibdir
  2650. INCDIR=\$(DESTDIR)$incdir
  2651. BINDIR=\$(DESTDIR)$bindir
  2652. DATADIR=\$(DESTDIR)$datadir
  2653. MANDIR=\$(DESTDIR)$mandir
  2654. SRC_PATH="$source_path"
  2655. SRC_PATH_BARE=$source_path
  2656. BUILD_ROOT="$PWD"
  2657. ARCH=$arch
  2658. CC=$cc
  2659. AS=$as
  2660. LD=$ld
  2661. DEPCC=$dep_cc
  2662. YASM=$yasmexe
  2663. AR=$ar
  2664. RANLIB=$ranlib
  2665. LN_S=$ln_s
  2666. STRIP=$strip
  2667. CPPFLAGS=$CPPFLAGS
  2668. CFLAGS=$CFLAGS
  2669. ASFLAGS=$ASFLAGS
  2670. CC_O=$CC_O
  2671. LDFLAGS=$LDFLAGS
  2672. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2673. SHFLAGS=$SHFLAGS
  2674. YASMFLAGS=$YASMFLAGS
  2675. BUILDSUF=$build_suffix
  2676. FULLNAME=$FULLNAME
  2677. LIBPREF=$LIBPREF
  2678. LIBSUF=$LIBSUF
  2679. LIBNAME=$LIBNAME
  2680. SLIBPREF=$SLIBPREF
  2681. SLIBSUF=$SLIBSUF
  2682. EXESUF=$EXESUF
  2683. EXTRA_VERSION=$extra_version
  2684. DEPFLAGS=$DEPFLAGS
  2685. CCDEP=$CCDEP
  2686. ASDEP=$ASDEP
  2687. CC_DEPFLAGS=$CC_DEPFLAGS
  2688. AS_DEPFLAGS=$AS_DEPFLAGS
  2689. HOSTCC=$host_cc
  2690. HOSTCFLAGS=$host_cflags
  2691. HOSTEXESUF=$HOSTEXESUF
  2692. HOSTLDFLAGS=$host_ldflags
  2693. HOSTLIBS=$host_libs
  2694. TARGET_EXEC=$target_exec
  2695. TARGET_PATH=$target_path
  2696. SDL_LIBS=$sdl_libs
  2697. SDL_CFLAGS=$sdl_cflags
  2698. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2699. EXTRALIBS=$extralibs
  2700. EOF
  2701. get_version(){
  2702. name=$1
  2703. file=$source_path/$2
  2704. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2705. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2706. lcname=$(tolower $name)
  2707. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2708. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2709. }
  2710. get_version LIBSWSCALE libswscale/swscale.h
  2711. get_version LIBPOSTPROC libpostproc/postprocess.h
  2712. get_version LIBAVCODEC libavcodec/avcodec.h
  2713. get_version LIBAVDEVICE libavdevice/avdevice.h
  2714. get_version LIBAVFORMAT libavformat/avformat.h
  2715. get_version LIBAVUTIL libavutil/avutil.h
  2716. get_version LIBAVFILTER libavfilter/avfilter.h
  2717. enabled shared && cat >> config.mak <<EOF
  2718. LIBTARGET=${LIBTARGET}
  2719. SLIBNAME=${SLIBNAME}
  2720. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2721. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2722. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2723. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2724. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2725. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2726. EOF
  2727. enabled asmalign_pot || align_shift="1 <<"
  2728. cat > $TMPH <<EOF
  2729. /* Automatically generated by configure - do not modify! */
  2730. #ifndef FFMPEG_CONFIG_H
  2731. #define FFMPEG_CONFIG_H
  2732. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2733. #define FFMPEG_LICENSE "$(c_escape $license)"
  2734. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2735. #define CC_TYPE "$cc_type"
  2736. #define CC_VERSION $cc_version
  2737. #define restrict $_restrict
  2738. #define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
  2739. #define EXTERN_PREFIX "${extern_prefix}"
  2740. #define EXTERN_ASM ${extern_prefix}
  2741. EOF
  2742. test -n "$malloc_prefix" &&
  2743. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2744. if enabled small || disabled optimizations; then
  2745. echo "#define av_always_inline" >> $TMPH
  2746. fi
  2747. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2748. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2749. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2750. $CONFIG_EXTRA \
  2751. $DECODER_LIST \
  2752. $ENCODER_LIST \
  2753. $HWACCEL_LIST \
  2754. $PARSER_LIST \
  2755. $BSF_LIST \
  2756. $DEMUXER_LIST \
  2757. $MUXER_LIST \
  2758. $FILTER_LIST \
  2759. $PROTOCOL_LIST \
  2760. $INDEV_LIST \
  2761. $OUTDEV_LIST \
  2762. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2763. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2764. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2765. cp_if_changed $TMPH config.h
  2766. cat > $TMPH <<EOF
  2767. /* Generated by ffconf */
  2768. #ifndef AVUTIL_AVCONFIG_H
  2769. #define AVUTIL_AVCONFIG_H
  2770. EOF
  2771. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2772. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2773. cp_if_changed $TMPH libavutil/avconfig.h
  2774. # build pkg-config files
  2775. pkgconfig_generate(){
  2776. name=$1
  2777. shortname=${name#lib}${build_suffix}
  2778. comment=$2
  2779. version=$3
  2780. libs=$4
  2781. requires=$5
  2782. cat <<EOF > $name/$name.pc
  2783. prefix=$prefix
  2784. exec_prefix=\${prefix}
  2785. libdir=$libdir
  2786. includedir=$incdir
  2787. Name: $name
  2788. Description: $comment
  2789. Version: $version
  2790. Requires: $(enabled shared || echo $requires)
  2791. Requires.private: $(enabled shared && echo $requires)
  2792. Conflicts:
  2793. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2794. Libs.private: $(enabled shared && echo $libs)
  2795. Cflags: -I\${includedir}
  2796. EOF
  2797. cat <<EOF > $name/$name-uninstalled.pc
  2798. prefix=
  2799. exec_prefix=
  2800. libdir=\${pcfiledir}
  2801. includedir=${source_path}
  2802. Name: $name
  2803. Description: $comment
  2804. Version: $version
  2805. Requires: $requires
  2806. Conflicts:
  2807. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2808. Cflags: -I\${includedir}
  2809. EOF
  2810. }
  2811. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2812. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2813. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2814. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2815. enabled avfilter &&
  2816. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2817. enabled postproc &&
  2818. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2819. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"