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.

3641 lines
109KB

  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.log]
  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-version2 force GPL version 2 [no]
  71. --enable-version3 upgrade (L)GPL to version 3 [no]
  72. --enable-nonfree allow use of nonfree code, the resulting libs
  73. and binaries will be unredistributable [no]
  74. --disable-doc do not build documentation
  75. --disable-ffmpeg disable ffmpeg build
  76. --disable-avconv disable avconv build
  77. --disable-ffplay disable ffplay build
  78. --disable-ffprobe disable ffprobe build
  79. --disable-ffserver disable ffserver build
  80. --disable-avdevice disable libavdevice build
  81. --disable-avcodec disable libavcodec build
  82. --disable-avformat disable libavformat build
  83. --disable-swresample disable libswresample build
  84. --disable-swscale disable libswscale build
  85. --disable-postproc disable libpostproc build
  86. --disable-avfilter disable video filter support [no]
  87. --disable-pthreads disable pthreads [auto]
  88. --enable-w32threads use Win32 threads [no]
  89. --enable-x11grab enable X11 grabbing [no]
  90. --disable-network disable network support [no]
  91. --enable-gray enable full grayscale support (slower color)
  92. --disable-swscale-alpha disable alpha channel support in swscale
  93. --disable-fastdiv disable table-based division
  94. --enable-small optimize for size instead of speed
  95. --disable-aandct disable AAN DCT code
  96. --disable-dct disable DCT code
  97. --disable-fft disable FFT code
  98. --disable-golomb disable Golomb code
  99. --disable-huffman disable Huffman code
  100. --disable-lpc disable LPC code
  101. --disable-mdct disable MDCT code
  102. --disable-rdft disable RDFT code
  103. --enable-vaapi enable VAAPI code [autodetect]
  104. --enable-vdpau enable VDPAU code [autodetect]
  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. --disable-everything disable all components listed below
  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-libcelt enable CELT/Opus decoding via libcelt [no]
  157. --enable-frei0r enable frei0r video filtering
  158. --enable-libaacplus enable AAC+ encoding via libaacplus [no]
  159. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  160. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  161. --enable-libopencv enable video filtering via libopencv [no]
  162. --enable-libcdio enable audio CD grabbing with libcdio
  163. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  164. and libraw1394 [no]
  165. --enable-libdirac enable Dirac support via libdirac [no]
  166. --enable-libfaac enable FAAC support via libfaac [no]
  167. --enable-libfreetype enable libfreetype [no]
  168. --enable-libgsm enable GSM support via libgsm [no]
  169. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  170. --enable-libnut enable NUT (de)muxing via libnut,
  171. native (de)muxer exists [no]
  172. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  173. --enable-librtmp enable RTMP[E] support via librtmp [no]
  174. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  175. --enable-libspeex enable Speex encoding and decoding via libspeex [no]
  176. --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
  177. --enable-libtheora enable Theora encoding via libtheora [no]
  178. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  179. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  180. --enable-libvorbis enable Vorbis encoding via libvorbis,
  181. native implementation exists [no]
  182. --enable-libvpx enable VP8 support via libvpx [no]
  183. --enable-libx264 enable H.264 encoding via x264 [no]
  184. --enable-libxavs enable AVS encoding via xavs [no]
  185. --enable-libxvid enable Xvid encoding via xvidcore,
  186. native MPEG-4/Xvid encoder exists [no]
  187. --enable-openal enable OpenAL 1.1 capture support [no]
  188. --enable-mlib enable Sun medialib [no]
  189. --enable-zlib enable zlib [autodetect]
  190. Advanced options (experts only):
  191. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  192. --enable-cross-compile assume a cross-compiler is used
  193. --sysroot=PATH root of cross-build tree
  194. --sysinclude=PATH location of cross-build system headers
  195. --target-os=OS compiler targets OS [$target_os]
  196. --target-exec=CMD command to run executables on target
  197. --target-path=DIR path to view of build directory on target
  198. --nm=NM use nm tool
  199. --ar=AR use archive tool AR [$ar_default]
  200. --as=AS use assembler AS [$as_default]
  201. --cc=CC use C compiler CC [$cc_default]
  202. --cxx=CXX use C compiler CXX [$cxx_default]
  203. --ld=LD use linker LD
  204. --host-cc=HOSTCC use host C compiler HOSTCC
  205. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  206. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  207. --host-libs=HLIBS use libs HLIBS when linking for host
  208. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  209. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  210. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  211. --extra-libs=ELIBS add ELIBS [$ELIBS]
  212. --extra-version=STRING version string suffix []
  213. --build-suffix=SUFFIX library name suffix []
  214. --progs-suffix=SUFFIX program name suffix []
  215. --arch=ARCH select architecture [$arch]
  216. --cpu=CPU select the minimum required CPU (affects
  217. instruction selection, may crash on older CPUs)
  218. --disable-asm disable all assembler optimizations
  219. --disable-altivec disable AltiVec optimizations
  220. --disable-amd3dnow disable 3DNow! optimizations
  221. --disable-amd3dnowext disable 3DNow! extended optimizations
  222. --disable-mmx disable MMX optimizations
  223. --disable-mmx2 disable MMX2 optimizations
  224. --disable-sse disable SSE optimizations
  225. --disable-ssse3 disable SSSE3 optimizations
  226. --disable-avx disable AVX optimizations
  227. --disable-armv5te disable armv5te optimizations
  228. --disable-armv6 disable armv6 optimizations
  229. --disable-armv6t2 disable armv6t2 optimizations
  230. --disable-armvfp disable ARM VFP optimizations
  231. --disable-iwmmxt disable iwmmxt optimizations
  232. --disable-mmi disable MMI optimizations
  233. --disable-neon disable neon optimizations
  234. --disable-vis disable VIS optimizations
  235. --disable-yasm disable use of yasm assembler
  236. --enable-pic build position-independent code
  237. --malloc-prefix=PFX prefix malloc and related names with PFX
  238. --enable-sram allow use of on-chip SRAM
  239. --disable-symver disable symbol versioning
  240. --optflags override optimization-related compiler flags
  241. Developer options (useful when working on FFmpeg itself):
  242. --disable-debug disable debugging symbols
  243. --enable-debug=LEVEL set the debug level [$debuglevel]
  244. --disable-optimizations disable compiler optimizations
  245. --enable-extra-warnings enable more compiler warnings
  246. --disable-stripping disable stripping of executables and shared libraries
  247. --samples=PATH location of test samples for FATE, if not set use
  248. \$FATE_SAMPLES at make invocation time.
  249. NOTE: Object files are built at the place where configure is launched.
  250. EOF
  251. exit 0
  252. }
  253. quotes='""'
  254. log(){
  255. echo "$@" >> $logfile
  256. }
  257. log_file(){
  258. log BEGIN $1
  259. pr -n -t $1 >> $logfile
  260. log END $1
  261. }
  262. echolog(){
  263. log "$@"
  264. echo "$@"
  265. }
  266. warn(){
  267. log "WARNING: $*"
  268. WARNINGS="${WARNINGS}WARNING: $*\n"
  269. }
  270. die(){
  271. echolog "$@"
  272. cat <<EOF
  273. If you think configure made a mistake, make sure you are using the latest
  274. version from Git. If the latest version fails, report the problem to the
  275. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  276. EOF
  277. if disabled logging; then
  278. cat <<EOF
  279. Rerun configure with logging enabled (do not use --disable-logging), and
  280. include the log this produces with your report.
  281. EOF
  282. else
  283. cat <<EOF
  284. Include the log file "$logfile" produced by configure as this will help
  285. solving the problem.
  286. EOF
  287. fi
  288. exit 1
  289. }
  290. # Avoid locale weirdness, besides we really just want to translate ASCII.
  291. toupper(){
  292. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  293. }
  294. tolower(){
  295. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  296. }
  297. c_escape(){
  298. echo "$*" | sed 's/["\\]/\\\0/g'
  299. }
  300. sh_quote(){
  301. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  302. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  303. echo "$v"
  304. }
  305. cleanws(){
  306. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  307. }
  308. filter(){
  309. pat=$1
  310. shift
  311. for v; do
  312. eval "case $v in $pat) echo $v ;; esac"
  313. done
  314. }
  315. filter_out(){
  316. pat=$1
  317. shift
  318. for v; do
  319. eval "case $v in $pat) ;; *) echo $v ;; esac"
  320. done
  321. }
  322. map(){
  323. m=$1
  324. shift
  325. for v; do eval $m; done
  326. }
  327. set_all(){
  328. value=$1
  329. shift
  330. for var in $*; do
  331. eval $var=$value
  332. done
  333. }
  334. set_weak(){
  335. value=$1
  336. shift
  337. for var; do
  338. eval : \${$var:=$value}
  339. done
  340. }
  341. set_safe(){
  342. var=$1
  343. shift
  344. eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
  345. }
  346. get_safe(){
  347. eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
  348. }
  349. pushvar(){
  350. for var in $*; do
  351. eval level=\${${var}_level:=0}
  352. eval ${var}_${level}="\$$var"
  353. eval ${var}_level=$(($level+1))
  354. done
  355. }
  356. popvar(){
  357. for var in $*; do
  358. eval level=\${${var}_level:-0}
  359. test $level = 0 && continue
  360. eval level=$(($level-1))
  361. eval $var="\${${var}_${level}}"
  362. eval ${var}_level=$level
  363. eval unset ${var}_${level}
  364. done
  365. }
  366. enable(){
  367. set_all yes $*
  368. }
  369. disable(){
  370. set_all no $*
  371. }
  372. enable_weak(){
  373. set_weak yes $*
  374. }
  375. disable_weak(){
  376. set_weak no $*
  377. }
  378. enable_safe(){
  379. for var; do
  380. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  381. done
  382. }
  383. disable_safe(){
  384. for var; do
  385. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  386. done
  387. }
  388. do_enable_deep(){
  389. for var; do
  390. enabled $var && continue
  391. eval sel="\$${var}_select"
  392. eval sgs="\$${var}_suggest"
  393. pushvar var sgs
  394. enable_deep $sel
  395. popvar sgs
  396. enable_deep_weak $sgs
  397. popvar var
  398. done
  399. }
  400. enable_deep(){
  401. do_enable_deep $*
  402. enable $*
  403. }
  404. enable_deep_weak(){
  405. do_enable_deep $*
  406. enable_weak $*
  407. }
  408. enabled(){
  409. test "${1#!}" = "$1" && op== || op=!=
  410. eval test "x\$${1#!}" $op "xyes"
  411. }
  412. disabled(){
  413. test "${1#!}" = "$1" && op== || op=!=
  414. eval test "x\$${1#!}" $op "xno"
  415. }
  416. enabled_all(){
  417. for opt; do
  418. enabled $opt || return 1
  419. done
  420. }
  421. disabled_all(){
  422. for opt; do
  423. disabled $opt || return 1
  424. done
  425. }
  426. enabled_any(){
  427. for opt; do
  428. enabled $opt && return 0
  429. done
  430. }
  431. disabled_any(){
  432. for opt; do
  433. disabled $opt && return 0
  434. done
  435. return 1
  436. }
  437. set_default(){
  438. for opt; do
  439. eval : \${$opt:=\$${opt}_default}
  440. done
  441. }
  442. is_in(){
  443. value=$1
  444. shift
  445. for var in $*; do
  446. [ $var = $value ] && return 0
  447. done
  448. return 1
  449. }
  450. check_deps(){
  451. for cfg; do
  452. cfg="${cfg#!}"
  453. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  454. disabled ${cfg}_checking && continue
  455. enable ${cfg}_checking
  456. eval dep_all="\$${cfg}_deps"
  457. eval dep_any="\$${cfg}_deps_any"
  458. eval dep_sel="\$${cfg}_select"
  459. eval dep_sgs="\$${cfg}_suggest"
  460. eval dep_ifa="\$${cfg}_if"
  461. eval dep_ifn="\$${cfg}_if_any"
  462. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  463. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  464. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  465. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  466. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  467. enabled_all $dep_all || disable $cfg
  468. enabled_any $dep_any || disable $cfg
  469. disabled_any $dep_sel && disable $cfg
  470. if enabled $cfg; then
  471. eval dep_extralibs="\$${cfg}_extralibs"
  472. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  473. enable_deep $dep_sel
  474. enable_deep_weak $dep_sgs
  475. fi
  476. disable ${cfg}_checking
  477. done
  478. }
  479. print_config_h(){
  480. enabled $1 && v=1 || v=0
  481. echo "#define $2 $v"
  482. }
  483. print_config_mak(){
  484. enabled $1 && v= || v=!
  485. echo "$v$2=yes"
  486. }
  487. print_config_asm(){
  488. enabled $1 && echo "%define $2"
  489. }
  490. print_config(){
  491. pfx=$1
  492. files=$2
  493. shift 2
  494. for cfg; do
  495. ucname="$(toupper $cfg)"
  496. for f in $files; do
  497. "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
  498. done
  499. done
  500. }
  501. print_enabled(){
  502. test "$1" = -n && end=" " && shift || end="\n"
  503. suf=$1
  504. shift
  505. for v; do
  506. enabled $v && printf "%s$end" ${v%$suf};
  507. done
  508. }
  509. append(){
  510. var=$1
  511. shift
  512. eval "$var=\"\$$var $*\""
  513. }
  514. prepend(){
  515. var=$1
  516. shift
  517. eval "$var=\"$* \$$var\""
  518. }
  519. add_cppflags(){
  520. append CPPFLAGS $($filter_cppflags "$@")
  521. }
  522. add_cflags(){
  523. append CFLAGS $($filter_cflags "$@")
  524. }
  525. add_cxxflags(){
  526. append CXXFLAGS $($filter_cflags "$@")
  527. }
  528. add_asflags(){
  529. append ASFLAGS $($filter_asflags "$@")
  530. }
  531. add_ldflags(){
  532. append LDFLAGS "$@"
  533. }
  534. add_extralibs(){
  535. prepend extralibs "$@"
  536. }
  537. check_cmd(){
  538. log "$@"
  539. "$@" >> $logfile 2>&1
  540. }
  541. check_cc(){
  542. log check_cc "$@"
  543. cat > $TMPC
  544. log_file $TMPC
  545. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  546. }
  547. check_cxx(){
  548. log check_cxx "$@"
  549. cat > $TMPCPP
  550. log_file $TMPCPP
  551. check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" -c -o $TMPO $TMPCPP
  552. }
  553. check_cpp(){
  554. log check_cpp "$@"
  555. cat > $TMPC
  556. log_file $TMPC
  557. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  558. }
  559. check_as(){
  560. log check_as "$@"
  561. cat > $TMPC
  562. log_file $TMPC
  563. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  564. }
  565. check_asm(){
  566. log check_asm "$@"
  567. name="$1"
  568. code="$2"
  569. shift 2
  570. disable $name
  571. check_as "$@" <<EOF && enable $name
  572. void foo(void){ __asm__ volatile($code); }
  573. EOF
  574. }
  575. check_yasm(){
  576. log check_yasm "$@"
  577. echo "$1" > $TMPS
  578. log_file $TMPS
  579. shift 1
  580. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  581. }
  582. check_ld(){
  583. log check_ld "$@"
  584. type=$1
  585. shift 1
  586. flags=''
  587. libs=''
  588. for f; do
  589. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  590. done
  591. check_$type $($filter_cflags $flags) || return
  592. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
  593. }
  594. check_cppflags(){
  595. log check_cppflags "$@"
  596. set -- $($filter_cppflags "$@")
  597. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  598. int x;
  599. EOF
  600. }
  601. check_cflags(){
  602. log check_cflags "$@"
  603. set -- $($filter_cflags "$@")
  604. check_cc "$@" <<EOF && append CFLAGS "$@"
  605. int x;
  606. EOF
  607. }
  608. check_cxxflags(){
  609. log check_cxxflags "$@"
  610. set -- $($filter_cflags "$@")
  611. check_cxx "$@" <<EOF && append CXXFLAGS "$@"
  612. int x;
  613. EOF
  614. }
  615. test_ldflags(){
  616. log test_ldflags "$@"
  617. check_ld "cc" "$@" <<EOF
  618. int main(void){ return 0; }
  619. EOF
  620. }
  621. check_ldflags(){
  622. log check_ldflags "$@"
  623. test_ldflags "$@" && add_ldflags "$@"
  624. }
  625. check_header(){
  626. log check_header "$@"
  627. header=$1
  628. shift
  629. disable_safe $header
  630. check_cpp "$@" <<EOF && enable_safe $header
  631. #include <$header>
  632. int x;
  633. EOF
  634. }
  635. check_func(){
  636. log check_func "$@"
  637. func=$1
  638. shift
  639. disable $func
  640. check_ld "cc" "$@" <<EOF && enable $func
  641. extern int $func();
  642. int main(void){ $func(); }
  643. EOF
  644. }
  645. check_mathfunc(){
  646. log check_mathfunc "$@"
  647. func=$1
  648. shift
  649. disable $func
  650. check_ld "cc" "$@" <<EOF && enable $func
  651. #include <math.h>
  652. float foo(float f) { return $func(f); }
  653. int main(void){ return (int) foo; }
  654. EOF
  655. }
  656. check_func_headers(){
  657. log check_func_headers "$@"
  658. headers=$1
  659. funcs=$2
  660. shift 2
  661. {
  662. for hdr in $headers; do
  663. echo "#include <$hdr>"
  664. done
  665. for func in $funcs; do
  666. echo "long check_$func(void) { return (long) $func; }"
  667. done
  668. echo "int main(void) { return 0; }"
  669. } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
  670. }
  671. check_class_headers_cpp(){
  672. log check_class_headers_cpp "$@"
  673. headers=$1
  674. classes=$2
  675. shift 2
  676. {
  677. for hdr in $headers; do
  678. echo "#include <$hdr>"
  679. done
  680. echo "int main(void) { "
  681. i=1
  682. for class in $classes; do
  683. echo "$class obj$i;"
  684. i=$(expr $i + 1)
  685. done
  686. echo "return 0; }"
  687. } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
  688. }
  689. check_cpp_condition(){
  690. log check_cpp_condition "$@"
  691. header=$1
  692. condition=$2
  693. shift 2
  694. check_cpp $($filter_cppflags "$@") <<EOF
  695. #include <$header>
  696. #if !($condition)
  697. #error "unsatisfied condition: $condition"
  698. #endif
  699. EOF
  700. }
  701. check_lib(){
  702. log check_lib "$@"
  703. header="$1"
  704. func="$2"
  705. shift 2
  706. check_header $header && check_func $func "$@" && add_extralibs "$@"
  707. }
  708. check_lib2(){
  709. log check_lib2 "$@"
  710. headers="$1"
  711. funcs="$2"
  712. shift 2
  713. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  714. }
  715. check_lib_cpp(){
  716. log check_lib_cpp "$@"
  717. headers="$1"
  718. classes="$2"
  719. shift 2
  720. check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
  721. }
  722. check_pkg_config(){
  723. log check_pkg_config "$@"
  724. pkg="$1"
  725. headers="$2"
  726. funcs="$3"
  727. shift 3
  728. $pkg_config --exists $pkg 2>/dev/null || return
  729. pkg_cflags=$($pkg_config --cflags $pkg)
  730. pkg_libs=$($pkg_config --libs $pkg)
  731. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  732. set_safe ${pkg}_cflags $pkg_cflags &&
  733. set_safe ${pkg}_libs $pkg_libs
  734. }
  735. check_exec(){
  736. check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  737. }
  738. check_exec_crash(){
  739. code=$(cat)
  740. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  741. # are safe but may not be available everywhere. Thus we use
  742. # raise(SIGTERM) instead. The check is run in a subshell so we
  743. # can redirect the "Terminated" message from the shell. SIGBUS
  744. # is not defined by standard C so it is used conditionally.
  745. (check_exec "$@") >> $logfile 2>&1 <<EOF
  746. #include <signal.h>
  747. static void sighandler(int sig){
  748. raise(SIGTERM);
  749. }
  750. int main(void){
  751. signal(SIGILL, sighandler);
  752. signal(SIGFPE, sighandler);
  753. signal(SIGSEGV, sighandler);
  754. #ifdef SIGBUS
  755. signal(SIGBUS, sighandler);
  756. #endif
  757. { $code }
  758. }
  759. EOF
  760. }
  761. check_type(){
  762. log check_type "$@"
  763. headers=$1
  764. type=$2
  765. shift 2
  766. disable_safe "$type"
  767. incs=""
  768. for hdr in $headers; do
  769. incs="$incs
  770. #include <$hdr>"
  771. done
  772. check_cc "$@" <<EOF && enable_safe "$type"
  773. $incs
  774. $type v;
  775. EOF
  776. }
  777. check_struct(){
  778. log check_type "$@"
  779. headers=$1
  780. struct=$2
  781. member=$3
  782. shift 3
  783. disable_safe "${struct}_${member}"
  784. incs=""
  785. for hdr in $headers; do
  786. incs="$incs
  787. #include <$hdr>"
  788. done
  789. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  790. $incs
  791. const void *p = &(($struct *)0)->$member;
  792. EOF
  793. }
  794. require(){
  795. name="$1"
  796. header="$2"
  797. func="$3"
  798. shift 3
  799. check_lib $header $func "$@" || die "ERROR: $name not found"
  800. }
  801. require2(){
  802. name="$1"
  803. headers="$2"
  804. func="$3"
  805. shift 3
  806. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  807. }
  808. require_cpp(){
  809. name="$1"
  810. headers="$2"
  811. classes="$3"
  812. shift 3
  813. check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
  814. }
  815. require_pkg_config(){
  816. pkg="$1"
  817. check_pkg_config "$@" || die "ERROR: $pkg not found"
  818. add_cflags $(get_safe ${pkg}_cflags)
  819. add_extralibs $(get_safe ${pkg}_libs)
  820. }
  821. check_host_cc(){
  822. log check_host_cc "$@"
  823. cat > $TMPC
  824. log_file $TMPC
  825. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  826. }
  827. check_host_cflags(){
  828. log check_host_cflags "$@"
  829. check_host_cc "$@" <<EOF && append host_cflags "$@"
  830. int x;
  831. EOF
  832. }
  833. apply(){
  834. file=$1
  835. shift
  836. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  837. }
  838. cp_if_changed(){
  839. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  840. mkdir -p "$(dirname $2)"
  841. cp -f "$1" "$2"
  842. }
  843. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  844. # system-dependent things.
  845. COMPONENT_LIST="
  846. bsfs
  847. decoders
  848. demuxers
  849. encoders
  850. filters
  851. hwaccels
  852. indevs
  853. muxers
  854. outdevs
  855. parsers
  856. protocols
  857. "
  858. CONFIG_LIST="
  859. $COMPONENT_LIST
  860. aandct
  861. ac3dsp
  862. avcodec
  863. avdevice
  864. avfilter
  865. avformat
  866. avisynth
  867. bzlib
  868. crystalhd
  869. dct
  870. doc
  871. dwt
  872. dxva2
  873. fastdiv
  874. ffmpeg
  875. avconv
  876. ffplay
  877. ffprobe
  878. ffserver
  879. fft
  880. frei0r
  881. golomb
  882. gpl
  883. gray
  884. h264dsp
  885. h264pred
  886. hardcoded_tables
  887. huffman
  888. libaacplus
  889. libcdio
  890. libcelt
  891. libdc1394
  892. libdirac
  893. libfaac
  894. libfreetype
  895. libgsm
  896. libmp3lame
  897. libnut
  898. libopencore_amrnb
  899. libopencore_amrwb
  900. libopencv
  901. libopenjpeg
  902. librtmp
  903. libschroedinger
  904. libspeex
  905. libstagefright_h264
  906. libtheora
  907. libvo_aacenc
  908. libvo_amrwbenc
  909. libvorbis
  910. libvpx
  911. libx264
  912. libxavs
  913. libxvid
  914. lpc
  915. lsp
  916. mdct
  917. memalign_hack
  918. mlib
  919. mpegaudiodsp
  920. network
  921. nonfree
  922. openal
  923. pic
  924. postproc
  925. rdft
  926. rtpdec
  927. runtime_cpudetect
  928. shared
  929. sinewin
  930. small
  931. sram
  932. static
  933. swresample
  934. swscale
  935. swscale_alpha
  936. thumb
  937. vaapi
  938. vdpau
  939. version2
  940. version3
  941. x11grab
  942. zlib
  943. "
  944. THREADS_LIST='
  945. pthreads
  946. w32threads
  947. '
  948. ARCH_LIST='
  949. alpha
  950. arm
  951. avr32
  952. avr32_ap
  953. avr32_uc
  954. bfin
  955. ia64
  956. m68k
  957. mips
  958. mips64
  959. parisc
  960. ppc
  961. ppc64
  962. s390
  963. sh4
  964. sparc
  965. sparc64
  966. tomi
  967. x86
  968. x86_32
  969. x86_64
  970. '
  971. ARCH_EXT_LIST='
  972. altivec
  973. amd3dnow
  974. amd3dnowext
  975. armv5te
  976. armv6
  977. armv6t2
  978. armvfp
  979. avx
  980. iwmmxt
  981. mmi
  982. mmx
  983. mmx2
  984. neon
  985. ppc4xx
  986. sse
  987. ssse3
  988. vfpv3
  989. vis
  990. '
  991. HAVE_LIST_PUB='
  992. bigendian
  993. fast_unaligned
  994. '
  995. HAVE_LIST="
  996. $ARCH_EXT_LIST
  997. $HAVE_LIST_PUB
  998. $THREADS_LIST
  999. aligned_stack
  1000. alsa_asoundlib_h
  1001. altivec_h
  1002. arpa_inet_h
  1003. asm_mod_y
  1004. attribute_may_alias
  1005. attribute_packed
  1006. bswap
  1007. closesocket
  1008. cmov
  1009. dcbzl
  1010. dev_bktr_ioctl_bt848_h
  1011. dev_bktr_ioctl_meteor_h
  1012. dev_ic_bt8xx_h
  1013. dev_video_meteor_ioctl_meteor_h
  1014. dev_video_bktr_ioctl_bt848_h
  1015. dlfcn_h
  1016. dlopen
  1017. dos_paths
  1018. ebp_available
  1019. ebx_available
  1020. exp2
  1021. exp2f
  1022. fast_64bit
  1023. fast_clz
  1024. fast_cmov
  1025. fcntl
  1026. fork
  1027. getaddrinfo
  1028. gethrtime
  1029. GetProcessMemoryInfo
  1030. GetProcessTimes
  1031. getrusage
  1032. gnu_as
  1033. struct_rusage_ru_maxrss
  1034. ibm_asm
  1035. inet_aton
  1036. inline_asm
  1037. isatty
  1038. kbhit
  1039. ldbrx
  1040. llrint
  1041. llrintf
  1042. local_aligned_16
  1043. local_aligned_8
  1044. localtime_r
  1045. log2
  1046. log2f
  1047. loongson
  1048. lrint
  1049. lrintf
  1050. lzo1x_999_compress
  1051. machine_ioctl_bt848_h
  1052. machine_ioctl_meteor_h
  1053. malloc_h
  1054. MapViewOfFile
  1055. memalign
  1056. mkstemp
  1057. mmap
  1058. PeekNamedPipe
  1059. posix_memalign
  1060. round
  1061. roundf
  1062. sdl
  1063. sdl_video_size
  1064. setmode
  1065. sndio_h
  1066. socklen_t
  1067. soundcard_h
  1068. poll_h
  1069. setrlimit
  1070. strerror_r
  1071. strptime
  1072. strtok_r
  1073. struct_addrinfo
  1074. struct_ipv6_mreq
  1075. struct_sockaddr_in6
  1076. struct_sockaddr_sa_len
  1077. struct_sockaddr_storage
  1078. symver
  1079. symver_gnu_asm
  1080. symver_asm_label
  1081. sys_mman_h
  1082. sys_resource_h
  1083. sys_select_h
  1084. sys_soundcard_h
  1085. sys_videoio_h
  1086. termios_h
  1087. threads
  1088. trunc
  1089. truncf
  1090. vfp_args
  1091. VirtualAlloc
  1092. winsock2_h
  1093. xform_asm
  1094. xmm_clobbers
  1095. yasm
  1096. "
  1097. # options emitted with CONFIG_ prefix but not available on command line
  1098. CONFIG_EXTRA="
  1099. avutil
  1100. gplv3
  1101. gplv2
  1102. lgplv3
  1103. "
  1104. CMDLINE_SELECT="
  1105. $ARCH_EXT_LIST
  1106. $CONFIG_LIST
  1107. $THREADS_LIST
  1108. asm
  1109. cross_compile
  1110. debug
  1111. extra_warnings
  1112. logging
  1113. optimizations
  1114. stripping
  1115. symver
  1116. yasm
  1117. "
  1118. PATHS_LIST='
  1119. bindir
  1120. datadir
  1121. incdir
  1122. libdir
  1123. mandir
  1124. prefix
  1125. shlibdir
  1126. '
  1127. CMDLINE_SET="
  1128. $PATHS_LIST
  1129. ar
  1130. arch
  1131. as
  1132. build_suffix
  1133. progs_suffix
  1134. cc
  1135. cpu
  1136. cross_prefix
  1137. cxx
  1138. dep_cc
  1139. extra_version
  1140. host_cc
  1141. host_cflags
  1142. host_ldflags
  1143. host_libs
  1144. host_os
  1145. install
  1146. ld
  1147. logfile
  1148. malloc_prefix
  1149. nm
  1150. optflags
  1151. pkg_config
  1152. samples
  1153. strip
  1154. sysinclude
  1155. sysroot
  1156. target_exec
  1157. target_os
  1158. target_path
  1159. "
  1160. CMDLINE_APPEND="
  1161. extra_cflags
  1162. extra_cxxflags
  1163. "
  1164. # code dependency declarations
  1165. # architecture extensions
  1166. armv5te_deps="arm"
  1167. armv6_deps="arm"
  1168. armv6t2_deps="arm"
  1169. armvfp_deps="arm"
  1170. iwmmxt_deps="arm"
  1171. neon_deps="arm"
  1172. vfpv3_deps="armvfp"
  1173. mmi_deps="mips"
  1174. altivec_deps="ppc"
  1175. ppc4xx_deps="ppc"
  1176. vis_deps="sparc"
  1177. x86_64_suggest="cmov fast_cmov"
  1178. amd3dnow_deps="mmx"
  1179. amd3dnowext_deps="amd3dnow"
  1180. mmx_deps="x86"
  1181. mmx2_deps="mmx"
  1182. sse_deps="mmx"
  1183. ssse3_deps="sse"
  1184. avx_deps="ssse3"
  1185. aligned_stack_if_any="ppc x86"
  1186. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1187. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1188. fast_unaligned_if_any="armv6 ppc x86"
  1189. need_memalign="altivec neon sse"
  1190. inline_asm_deps="!tms470"
  1191. symver_if_any="symver_asm_label symver_gnu_asm"
  1192. # subsystems
  1193. dct_select="rdft"
  1194. mdct_select="fft"
  1195. rdft_select="fft"
  1196. mpegaudiodsp_select="dct"
  1197. # decoders / encoders / hardware accelerators
  1198. aac_decoder_select="mdct sinewin"
  1199. aac_encoder_select="mdct sinewin"
  1200. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1201. ac3_decoder_select="mdct ac3dsp ac3_parser"
  1202. ac3_encoder_select="mdct ac3dsp"
  1203. ac3_fixed_encoder_select="mdct ac3dsp"
  1204. alac_encoder_select="lpc"
  1205. amrnb_decoder_select="lsp"
  1206. amrwb_decoder_select="lsp"
  1207. atrac1_decoder_select="mdct sinewin"
  1208. atrac3_decoder_select="mdct"
  1209. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1210. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1211. cavs_decoder_select="golomb"
  1212. cook_decoder_select="mdct sinewin"
  1213. cscd_decoder_suggest="zlib"
  1214. dca_decoder_select="mdct"
  1215. dnxhd_encoder_select="aandct"
  1216. dxa_decoder_select="zlib"
  1217. eac3_decoder_select="ac3_decoder"
  1218. eac3_encoder_select="mdct ac3dsp"
  1219. eamad_decoder_select="aandct"
  1220. eatgq_decoder_select="aandct"
  1221. eatqi_decoder_select="aandct"
  1222. ffv1_decoder_select="golomb"
  1223. flac_decoder_select="golomb"
  1224. flac_encoder_select="golomb lpc"
  1225. flashsv_decoder_select="zlib"
  1226. flashsv_encoder_select="zlib"
  1227. flashsv2_encoder_select="zlib"
  1228. flashsv2_decoder_select="zlib"
  1229. flv_decoder_select="h263_decoder"
  1230. flv_encoder_select="h263_encoder"
  1231. fraps_decoder_select="huffman"
  1232. h261_encoder_select="aandct"
  1233. h263_decoder_select="h263_parser"
  1234. h263_encoder_select="aandct"
  1235. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1236. h263i_decoder_select="h263_decoder"
  1237. h263p_encoder_select="h263_encoder"
  1238. h264_decoder_select="golomb h264dsp h264pred"
  1239. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  1240. h264_dxva2_hwaccel_deps="dxva2api_h"
  1241. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1242. h264_vaapi_hwaccel_select="vaapi"
  1243. h264_vdpau_decoder_select="vdpau h264_decoder"
  1244. imc_decoder_select="fft mdct sinewin"
  1245. jpegls_decoder_select="golomb"
  1246. jpegls_encoder_select="golomb"
  1247. ljpeg_encoder_select="aandct"
  1248. loco_decoder_select="golomb"
  1249. mjpeg_encoder_select="aandct"
  1250. mlp_decoder_select="mlp_parser"
  1251. mp1_decoder_select="mpegaudiodsp"
  1252. mp2_decoder_select="mpegaudiodsp"
  1253. mp3adu_decoder_select="mpegaudiodsp"
  1254. mp3_decoder_select="mpegaudiodsp"
  1255. mp3on4_decoder_select="mpegaudiodsp"
  1256. mp1float_decoder_select="mpegaudiodsp"
  1257. mp2float_decoder_select="mpegaudiodsp"
  1258. mp3adufloat_decoder_select="mpegaudiodsp"
  1259. mp3float_decoder_select="mpegaudiodsp"
  1260. mp3on4float_decoder_select="mpegaudiodsp"
  1261. mpeg1video_encoder_select="aandct"
  1262. mpeg2video_encoder_select="aandct"
  1263. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1264. mpeg4_encoder_select="h263_encoder"
  1265. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1266. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1267. mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
  1268. mpeg2_crystalhd_decoder_select="crystalhd"
  1269. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1270. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1271. mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
  1272. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1273. mpeg4_crystalhd_decoder_select="crystalhd"
  1274. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1275. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1276. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1277. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1278. msmpeg4_crystalhd_decoder_select="crystalhd"
  1279. msmpeg4v1_decoder_select="h263_decoder"
  1280. msmpeg4v1_encoder_select="h263_encoder"
  1281. msmpeg4v2_decoder_select="h263_decoder"
  1282. msmpeg4v2_encoder_select="h263_encoder"
  1283. msmpeg4v3_decoder_select="h263_decoder"
  1284. msmpeg4v3_encoder_select="h263_encoder"
  1285. nellymoser_decoder_select="mdct sinewin"
  1286. nellymoser_encoder_select="mdct sinewin"
  1287. png_decoder_select="zlib"
  1288. png_encoder_select="zlib"
  1289. prores_gpl_decoder_deps="version2 gpl"
  1290. qcelp_decoder_select="lsp"
  1291. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1292. ra_144_encoder_select="lpc"
  1293. rv10_decoder_select="h263_decoder"
  1294. rv10_encoder_select="h263_encoder"
  1295. rv20_decoder_select="h263_decoder"
  1296. rv20_encoder_select="h263_encoder"
  1297. rv30_decoder_select="golomb h264pred"
  1298. rv40_decoder_select="golomb h264pred"
  1299. shorten_decoder_select="golomb"
  1300. sipr_decoder_select="lsp"
  1301. snow_decoder_select="dwt"
  1302. snow_encoder_select="aandct dwt"
  1303. sonic_decoder_select="golomb"
  1304. sonic_encoder_select="golomb"
  1305. sonic_ls_encoder_select="golomb"
  1306. svq1_encoder_select="aandct"
  1307. svq3_decoder_select="golomb h264dsp h264pred"
  1308. svq3_decoder_suggest="zlib"
  1309. theora_decoder_select="vp3_decoder"
  1310. tiff_decoder_suggest="zlib"
  1311. tiff_encoder_suggest="zlib"
  1312. truehd_decoder_select="mlp_decoder"
  1313. tscc_decoder_select="zlib"
  1314. twinvq_decoder_select="mdct lsp sinewin"
  1315. vc1_decoder_select="h263_decoder"
  1316. vc1_crystalhd_decoder_select="crystalhd"
  1317. vc1_dxva2_hwaccel_deps="dxva2api_h"
  1318. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1319. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1320. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1321. vc1image_decoder_select="vc1_decoder"
  1322. vorbis_decoder_select="mdct"
  1323. vorbis_encoder_select="mdct"
  1324. vp6_decoder_select="huffman"
  1325. vp6a_decoder_select="vp6_decoder"
  1326. vp6f_decoder_select="vp6_decoder"
  1327. vp8_decoder_select="h264pred"
  1328. wmapro_decoder_select="mdct sinewin"
  1329. wmav1_decoder_select="mdct sinewin"
  1330. wmav1_encoder_select="mdct sinewin"
  1331. wmav2_decoder_select="mdct sinewin"
  1332. wmav2_encoder_select="mdct sinewin"
  1333. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1334. wmv1_decoder_select="h263_decoder"
  1335. wmv1_encoder_select="h263_encoder"
  1336. wmv2_decoder_select="h263_decoder"
  1337. wmv2_encoder_select="h263_encoder"
  1338. wmv3_decoder_select="vc1_decoder"
  1339. wmv3_crystalhd_decoder_select="crystalhd"
  1340. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1341. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1342. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1343. wmv3image_decoder_select="wmv3_decoder"
  1344. zlib_decoder_select="zlib"
  1345. zlib_encoder_select="zlib"
  1346. zmbv_decoder_select="zlib"
  1347. zmbv_encoder_select="zlib"
  1348. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  1349. vaapi_deps="va_va_h"
  1350. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1351. # parsers
  1352. h264_parser_select="golomb h264dsp h264pred"
  1353. # external libraries
  1354. libaacplus_encoder_deps="libaacplus"
  1355. libcelt_decoder_deps="libcelt"
  1356. libdirac_decoder_deps="libdirac !libschroedinger"
  1357. libdirac_encoder_deps="libdirac"
  1358. libfaac_encoder_deps="libfaac"
  1359. libgsm_decoder_deps="libgsm"
  1360. libgsm_encoder_deps="libgsm"
  1361. libgsm_ms_decoder_deps="libgsm"
  1362. libgsm_ms_encoder_deps="libgsm"
  1363. libmp3lame_encoder_deps="libmp3lame"
  1364. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1365. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1366. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1367. libopenjpeg_decoder_deps="libopenjpeg"
  1368. libschroedinger_decoder_deps="libschroedinger"
  1369. libschroedinger_encoder_deps="libschroedinger"
  1370. libspeex_decoder_deps="libspeex"
  1371. libspeex_encoder_deps="libspeex"
  1372. libstagefright_h264_decoder_deps="libstagefright_h264"
  1373. libtheora_encoder_deps="libtheora"
  1374. libvo_aacenc_encoder_deps="libvo_aacenc"
  1375. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1376. libvorbis_encoder_deps="libvorbis"
  1377. libvpx_decoder_deps="libvpx"
  1378. libvpx_encoder_deps="libvpx"
  1379. libx264_encoder_deps="libx264"
  1380. libxavs_encoder_deps="libxavs"
  1381. libxvid_encoder_deps="libxvid"
  1382. # demuxers / muxers
  1383. ac3_demuxer_select="ac3_parser"
  1384. asf_stream_muxer_select="asf_muxer"
  1385. avisynth_demuxer_deps="avisynth"
  1386. dirac_demuxer_select="dirac_parser"
  1387. eac3_demuxer_select="ac3_parser"
  1388. flac_demuxer_select="flac_parser"
  1389. ipod_muxer_select="mov_muxer"
  1390. libnut_demuxer_deps="libnut"
  1391. libnut_muxer_deps="libnut"
  1392. matroska_audio_muxer_select="matroska_muxer"
  1393. matroska_demuxer_suggest="zlib bzlib"
  1394. mov_demuxer_suggest="zlib"
  1395. mp3_demuxer_select="mpegaudio_parser"
  1396. mp4_muxer_select="mov_muxer"
  1397. mpegtsraw_demuxer_select="mpegts_demuxer"
  1398. mxf_d10_muxer_select="mxf_muxer"
  1399. ogg_demuxer_select="golomb"
  1400. psp_muxer_select="mov_muxer"
  1401. rtp_demuxer_select="sdp_demuxer"
  1402. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1403. rtsp_demuxer_select="http_protocol rtpdec"
  1404. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1405. sap_demuxer_select="sdp_demuxer"
  1406. sap_muxer_select="rtp_muxer rtp_protocol"
  1407. sdp_demuxer_select="rtpdec"
  1408. spdif_muxer_select="aac_parser"
  1409. tg2_muxer_select="mov_muxer"
  1410. tgp_muxer_select="mov_muxer"
  1411. w64_demuxer_deps="wav_demuxer"
  1412. # indevs / outdevs
  1413. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1414. alsa_outdev_deps="alsa_asoundlib_h"
  1415. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1416. dshow_indev_deps="IBaseFilter"
  1417. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  1418. dv1394_indev_deps="dv1394 dv_demuxer"
  1419. fbdev_indev_deps="linux_fb_h"
  1420. jack_indev_deps="jack_jack_h sem_timedwait"
  1421. lavfi_indev_deps="avfilter"
  1422. libcdio_indev_deps="libcdio"
  1423. libdc1394_indev_deps="libdc1394"
  1424. openal_indev_deps="openal"
  1425. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1426. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1427. sdl_outdev_deps="sdl"
  1428. sndio_indev_deps="sndio_h"
  1429. sndio_outdev_deps="sndio_h"
  1430. v4l_indev_deps="linux_videodev_h"
  1431. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1432. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1433. vfwcap_indev_extralibs="-lavicap32"
  1434. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1435. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1436. # protocols
  1437. gopher_protocol_deps="network"
  1438. http_protocol_deps="network"
  1439. http_protocol_select="tcp_protocol"
  1440. mmsh_protocol_select="http_protocol"
  1441. mmst_protocol_deps="network"
  1442. rtmp_protocol_select="tcp_protocol"
  1443. rtp_protocol_select="udp_protocol"
  1444. tcp_protocol_deps="network"
  1445. udp_protocol_deps="network"
  1446. # filters
  1447. abuffer_filter_deps="strtok_r"
  1448. aconvert_filter_deps="strtok_r"
  1449. aformat_filter_deps="strtok_r"
  1450. amovie_filter_deps="avcodec avformat"
  1451. blackframe_filter_deps="gpl"
  1452. boxblur_filter_deps="gpl"
  1453. cropdetect_filter_deps="gpl"
  1454. delogo_filter_deps="gpl"
  1455. drawtext_filter_deps="libfreetype"
  1456. frei0r_filter_deps="frei0r dlopen strtok_r"
  1457. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1458. hqdn3d_filter_deps="gpl"
  1459. movie_filter_deps="avcodec avformat"
  1460. mp_filter_deps="gpl avcodec"
  1461. mptestsrc_filter_deps="gpl"
  1462. negate_filter_deps="lut_filter"
  1463. ocv_filter_deps="libopencv"
  1464. scale_filter_deps="swscale"
  1465. yadif_filter_deps="gpl"
  1466. # libraries
  1467. avdevice_deps="avcodec avformat"
  1468. avformat_deps="avcodec"
  1469. postproc_deps="gpl"
  1470. # programs
  1471. ffmpeg_deps="avcodec avformat swscale swresample"
  1472. ffmpeg_select="buffer_filter buffersink_filter"
  1473. avconv_deps="avcodec avformat swscale"
  1474. avconv_select="buffer_filter"
  1475. ffplay_deps="avcodec avformat swscale sdl"
  1476. ffplay_select="buffersink_filter rdft"
  1477. ffprobe_deps="avcodec avformat"
  1478. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1479. ffserver_extralibs='$ldl'
  1480. doc_deps="texi2html"
  1481. # tests
  1482. test_deps(){
  1483. suf1=$1
  1484. suf2=$2
  1485. shift 2
  1486. for v; do
  1487. dep=${v%=*}
  1488. tests=${v#*=}
  1489. for name in ${tests}; do
  1490. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1491. done
  1492. done
  1493. }
  1494. mxf_d10_test_deps="avfilter"
  1495. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1496. test_deps _encoder _decoder \
  1497. adpcm_g726=g726 \
  1498. adpcm_ima_qt \
  1499. adpcm_ima_wav \
  1500. adpcm_ms \
  1501. adpcm_swf \
  1502. adpcm_yamaha=adpcm_yam \
  1503. alac \
  1504. asv1 \
  1505. asv2 \
  1506. bmp \
  1507. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1508. dvvideo="dv dv50" \
  1509. ffv1 \
  1510. flac \
  1511. flashsv \
  1512. flv \
  1513. gif \
  1514. h261 \
  1515. h263="h263 h263p" \
  1516. huffyuv \
  1517. jpegls \
  1518. mjpeg="jpg mjpeg ljpeg" \
  1519. mp2 \
  1520. mpeg1video="mpeg mpeg1b" \
  1521. mpeg2video="mpeg2 mpeg2thread" \
  1522. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1523. msmpeg4v3=msmpeg4 \
  1524. msmpeg4v2 \
  1525. pbm=pbmpipe \
  1526. pcx \
  1527. pgm="pgm pgmpipe" \
  1528. png \
  1529. ppm="ppm ppmpipe" \
  1530. rawvideo="rgb yuv" \
  1531. roq \
  1532. rv10 \
  1533. rv20 \
  1534. sgi \
  1535. snow="snow snowll" \
  1536. svq1 \
  1537. targa=tga \
  1538. tiff \
  1539. wmav1 \
  1540. wmav2 \
  1541. wmv1 \
  1542. wmv2 \
  1543. test_deps _muxer _demuxer \
  1544. aiff \
  1545. pcm_alaw=alaw \
  1546. asf \
  1547. au \
  1548. avi \
  1549. dv=dv_fmt \
  1550. ffm \
  1551. flv=flv_fmt \
  1552. gxf \
  1553. matroska=mkv \
  1554. mmf \
  1555. mov \
  1556. pcm_mulaw=mulaw \
  1557. mxf="mxf mxf_d10" \
  1558. nut \
  1559. ogg \
  1560. rawvideo=pixfmt \
  1561. rm \
  1562. swf \
  1563. mpegts=ts \
  1564. voc \
  1565. wav \
  1566. yuv4mpegpipe=yuv4mpeg \
  1567. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
  1568. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1569. # default parameters
  1570. logfile="config.log"
  1571. # installation paths
  1572. prefix_default="/usr/local"
  1573. bindir_default='${prefix}/bin'
  1574. datadir_default='${prefix}/share/ffmpeg'
  1575. incdir_default='${prefix}/include'
  1576. libdir_default='${prefix}/lib'
  1577. mandir_default='${prefix}/share/man'
  1578. shlibdir_default="$libdir_default"
  1579. # toolchain
  1580. ar_default="ar"
  1581. cc_default="gcc"
  1582. cxx_default="g++"
  1583. cc_version=\"unknown\"
  1584. host_cc_default="gcc"
  1585. install="install"
  1586. ln_s="ln -sf"
  1587. nm_default="nm"
  1588. objformat="elf"
  1589. pkg_config_default=pkg-config
  1590. ranlib="ranlib"
  1591. strip_default="strip"
  1592. yasmexe="yasm"
  1593. nogas=":"
  1594. nm_opts='-g'
  1595. # machine
  1596. arch_default=$(uname -m)
  1597. cpu="generic"
  1598. # OS
  1599. target_os_default=$(tolower $(uname -s))
  1600. host_os=$target_os_default
  1601. # configurable options
  1602. enable avcodec
  1603. enable avdevice
  1604. enable avfilter
  1605. enable avformat
  1606. enable avutil
  1607. enable asm
  1608. enable debug
  1609. enable doc
  1610. enable fastdiv
  1611. enable ffmpeg
  1612. enable avconv
  1613. enable ffplay
  1614. enable ffprobe
  1615. enable ffserver
  1616. enable network
  1617. enable optimizations
  1618. enable postproc
  1619. enable protocols
  1620. enable static
  1621. enable stripping
  1622. enable swresample
  1623. enable swscale
  1624. enable swscale_alpha
  1625. # build settings
  1626. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1627. FFSERVERLDFLAGS=-Wl,-E
  1628. LIBPREF="lib"
  1629. LIBSUF=".a"
  1630. FULLNAME='$(NAME)$(BUILDSUF)'
  1631. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1632. SLIBPREF="lib"
  1633. SLIBSUF=".so"
  1634. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1635. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1636. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1637. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1638. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1639. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1640. AS_O='-o $@'
  1641. CC_O='-o $@'
  1642. CXX_O='-o $@'
  1643. host_cflags='-D_ISOC99_SOURCE -O3 -g'
  1644. host_libs='-lm'
  1645. target_path='$(CURDIR)'
  1646. # since the object filename is not given with the -MM flag, the compiler
  1647. # is only able to print the basename, and we must add the path ourselves
  1648. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1649. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1650. # find source path
  1651. if test -f configure; then
  1652. source_path=.
  1653. else
  1654. source_path=$(cd $(dirname "$0"); pwd)
  1655. echo "$source_path" | grep -q '[[:blank:]]' &&
  1656. die "Out of tree builds are impossible with whitespace in source path."
  1657. test -e "$source_path/config.h" &&
  1658. die "Out of tree builds are impossible with config.h in source dir."
  1659. fi
  1660. for v in "$@"; do
  1661. r=${v#*=}
  1662. l=${v%"$r"}
  1663. r=$(sh_quote "$r")
  1664. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1665. done
  1666. find_things(){
  1667. thing=$1
  1668. pattern=$2
  1669. file=$source_path/$3
  1670. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1671. }
  1672. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1673. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1674. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1675. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1676. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1677. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1678. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1679. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1680. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1681. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1682. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1683. find_tests(){
  1684. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1685. }
  1686. ACODEC_TESTS=$(find_tests acodec)
  1687. VCODEC_TESTS=$(find_tests vsynth1)
  1688. LAVF_TESTS=$(find_tests lavf)
  1689. LAVFI_TESTS=$(find_tests lavfi)
  1690. SEEK_TESTS=$(find_tests seek seek_)
  1691. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1692. for n in $COMPONENT_LIST; do
  1693. v=$(toupper ${n%s})_LIST
  1694. eval enable \$$v
  1695. eval ${n}_if_any="\$$v"
  1696. done
  1697. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
  1698. die_unknown(){
  1699. echo "Unknown option \"$1\"."
  1700. echo "See $0 --help for available options."
  1701. exit 1
  1702. }
  1703. show_list() {
  1704. suffix=_$1
  1705. shift
  1706. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1707. exit 0
  1708. }
  1709. for opt do
  1710. optval="${opt#*=}"
  1711. case "$opt" in
  1712. --extra-ldflags=*) add_ldflags $optval
  1713. ;;
  1714. --extra-libs=*) add_extralibs $optval
  1715. ;;
  1716. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1717. ;;
  1718. --enable-debug=*) debuglevel="$optval"
  1719. ;;
  1720. --disable-everything)
  1721. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1722. ;;
  1723. --enable-*=*|--disable-*=*)
  1724. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1725. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1726. eval list=\$$(toupper $thing)_LIST
  1727. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1728. $action $(filter "$name" $list)
  1729. ;;
  1730. --enable-?*|--disable-?*)
  1731. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1732. if is_in $option $COMPONENT_LIST; then
  1733. test $action = disable && action=unset
  1734. eval $action \$$(toupper ${option%s})_LIST
  1735. elif is_in $option $CMDLINE_SELECT; then
  1736. $action $option
  1737. else
  1738. die_unknown $opt
  1739. fi
  1740. ;;
  1741. --list-*)
  1742. NAME="${opt#--list-}"
  1743. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1744. NAME=${NAME%s}
  1745. eval show_list $NAME \$$(toupper $NAME)_LIST
  1746. ;;
  1747. --help|-h) show_help
  1748. ;;
  1749. *)
  1750. optname="${opt%%=*}"
  1751. optname="${optname#--}"
  1752. optname=$(echo "$optname" | sed 's/-/_/g')
  1753. if is_in $optname $CMDLINE_SET; then
  1754. eval $optname='$optval'
  1755. elif is_in $optname $CMDLINE_APPEND; then
  1756. append $optname "$optval"
  1757. else
  1758. die_unknown $opt
  1759. fi
  1760. ;;
  1761. esac
  1762. done
  1763. disabled logging && logfile=/dev/null
  1764. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1765. set >> $logfile
  1766. test -n "$cross_prefix" && enable cross_compile
  1767. if enabled cross_compile; then
  1768. test -n "$arch" && test -n "$target_os" ||
  1769. die "Must specify target arch and OS when cross-compiling"
  1770. fi
  1771. set_default arch target_os
  1772. ar_default="${cross_prefix}${ar_default}"
  1773. cc_default="${cross_prefix}${cc_default}"
  1774. cxx_default="${cross_prefix}${cxx_default}"
  1775. nm_default="${cross_prefix}${nm_default}"
  1776. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1777. ranlib="${cross_prefix}${ranlib}"
  1778. strip_default="${cross_prefix}${strip_default}"
  1779. sysinclude_default="${sysroot}/usr/include"
  1780. set_default cc cxx nm pkg_config strip sysinclude
  1781. enabled cross_compile || host_cc_default=$cc
  1782. set_default host_cc
  1783. if ! $pkg_config --version >/dev/null 2>&1; then
  1784. warn "$pkg_config not found, library detection may fail."
  1785. pkg_config=false
  1786. fi
  1787. exesuf() {
  1788. case $1 in
  1789. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1790. esac
  1791. }
  1792. EXESUF=$(exesuf $target_os)
  1793. HOSTEXESUF=$(exesuf $host_os)
  1794. # set temporary file name
  1795. : ${TMPDIR:=$TEMPDIR}
  1796. : ${TMPDIR:=$TMP}
  1797. : ${TMPDIR:=/tmp}
  1798. if ! check_cmd mktemp -u XXXXXX; then
  1799. # simple replacement for missing mktemp
  1800. # NOT SAFE FOR GENERAL USE
  1801. mktemp(){
  1802. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1803. }
  1804. fi
  1805. tmpfile(){
  1806. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1807. (set -C; exec > $tmp) 2>/dev/null ||
  1808. die "Unable to create temporary file in $TMPDIR."
  1809. append TMPFILES $tmp
  1810. eval $1=$tmp
  1811. }
  1812. trap 'rm -f -- $TMPFILES' EXIT
  1813. tmpfile TMPC .c
  1814. tmpfile TMPCPP .cpp
  1815. tmpfile TMPE $EXESUF
  1816. tmpfile TMPH .h
  1817. tmpfile TMPO .o
  1818. tmpfile TMPS .S
  1819. tmpfile TMPV .ver
  1820. tmpfile TMPSH .sh
  1821. tmpfile TMPASM .asm
  1822. unset -f mktemp
  1823. chmod +x $TMPE
  1824. # make sure we can execute files in $TMPDIR
  1825. cat > $TMPSH 2>> $logfile <<EOF
  1826. #! /bin/sh
  1827. EOF
  1828. chmod +x $TMPSH >> $logfile 2>&1
  1829. if ! $TMPSH >> $logfile 2>&1; then
  1830. cat <<EOF
  1831. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1832. variable to another directory and make sure that it is not mounted noexec.
  1833. EOF
  1834. die "Sanity test failed."
  1835. fi
  1836. filter_cflags=echo
  1837. filter_cppflags=echo
  1838. filter_asflags=echo
  1839. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1840. cc_type=llvm_gcc
  1841. cc_version=__VERSION__
  1842. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1843. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1844. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1845. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1846. speed_cflags='-O3'
  1847. size_cflags='-Os'
  1848. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1849. cc_type=gcc
  1850. cc_version=__VERSION__
  1851. gcc_version=$($cc --version | head -n1)
  1852. gcc_basever=$($cc -dumpversion)
  1853. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  1854. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  1855. cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  1856. if ! $cc -dumpversion | grep -q '^2\.'; then
  1857. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1858. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1859. fi
  1860. speed_cflags='-O3'
  1861. size_cflags='-Os'
  1862. elif $cc --version 2>/dev/null | grep -q Intel; then
  1863. cc_type=icc
  1864. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1865. cc_ident=$($cc --version | head -n1)
  1866. icc_version=$($cc -dumpversion)
  1867. CC_DEPFLAGS='-MMD'
  1868. AS_DEPFLAGS='-MMD'
  1869. speed_cflags='-O3'
  1870. size_cflags='-Os'
  1871. noopt_cflags='-O1'
  1872. elif $cc -v 2>&1 | grep -q xlc; then
  1873. cc_type=xlc
  1874. cc_version="AV_STRINGIFY(__IBMC__)"
  1875. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1876. speed_cflags='-O5'
  1877. size_cflags='-O5 -qcompact'
  1878. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1879. cc_type=ccc
  1880. cc_version="AV_STRINGIFY(__DECC_VER)"
  1881. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1882. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1883. debuglevel=3
  1884. add_ldflags -Wl,-z,now # calls to libots crash without this
  1885. speed_cflags='-fast'
  1886. size_cflags='-O1'
  1887. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1888. test -d "$sysroot" || die "No valid sysroot specified."
  1889. cc_type=armcc
  1890. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1891. cc_ident=$($cc --vsn | head -n1)
  1892. armcc_conf="$PWD/armcc.conf"
  1893. $cc --arm_linux_configure \
  1894. --arm_linux_config_file="$armcc_conf" \
  1895. --configure_sysroot="$sysroot" \
  1896. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1897. die "Error creating armcc configuration file."
  1898. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1899. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1900. as_default="${cross_prefix}gcc"
  1901. CC_DEPFLAGS='-MMD'
  1902. AS_DEPFLAGS='-MMD'
  1903. speed_cflags='-O3'
  1904. size_cflags='-Os'
  1905. filter_asflags="filter_out -W${armcc_opt}*"
  1906. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1907. cc_type=tms470
  1908. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1909. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1910. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1911. CC_O='-fr=$(@D)'
  1912. as_default="${cross_prefix}gcc"
  1913. ld_default="${cross_prefix}gcc"
  1914. TMPO=$(basename $TMPC .c).o
  1915. append TMPFILES $TMPO
  1916. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1917. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1918. AS_DEPFLAGS='-MMD'
  1919. speed_cflags='-O3 -mf=5'
  1920. size_cflags='-O3 -mf=2'
  1921. filter_cflags=tms470_flags
  1922. tms470_flags(){
  1923. for flag; do
  1924. case $flag in
  1925. -march=*|-mcpu=*)
  1926. case "${flag#*=}" in
  1927. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1928. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1929. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1930. armv6*|arm11*) echo -mv=6 ;;
  1931. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1932. echo -mv=5e ;;
  1933. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1934. esac
  1935. ;;
  1936. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1937. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1938. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1939. -msoft-float) echo --float_support=vfplib ;;
  1940. -O[0-3]|-mf=*) echo $flag ;;
  1941. -g) echo -g -mn ;;
  1942. -pds=*) echo $flag ;;
  1943. esac
  1944. done
  1945. }
  1946. elif $cc -v 2>&1 | grep -q clang; then
  1947. cc_type=clang
  1948. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1949. cc_version=__clang_version__ || cc_version=__VERSION__
  1950. cc_ident=$($cc --version | head -n1)
  1951. CC_DEPFLAGS='-MMD'
  1952. AS_DEPFLAGS='-MMD'
  1953. speed_cflags='-O3'
  1954. size_cflags='-Os'
  1955. elif $cc -V 2>&1 | grep -q Sun; then
  1956. cc_type=suncc
  1957. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1958. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1959. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1960. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1961. add_ldflags -xc99
  1962. speed_cflags='-O5'
  1963. size_cflags='-O5 -xspace'
  1964. filter_cflags=suncc_flags
  1965. suncc_flags(){
  1966. for flag; do
  1967. case $flag in
  1968. -march=*|-mcpu=*)
  1969. case "${flag#*=}" in
  1970. native) echo -xtarget=native ;;
  1971. v9|niagara) echo -xarch=sparc ;;
  1972. ultrasparc) echo -xarch=sparcvis ;;
  1973. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1974. i586|pentium) echo -xchip=pentium ;;
  1975. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1976. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1977. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1978. pentium4*) echo -xtarget=pentium4 ;;
  1979. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1980. *-sse3) echo -xarch=sse3 ;;
  1981. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1982. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1983. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1984. k8|opteron|athlon64|athlon-fx)
  1985. echo -xarch=sse2a ;;
  1986. athlon*) echo -xarch=pentium_proa ;;
  1987. esac
  1988. ;;
  1989. -std=c99) echo -xc99 ;;
  1990. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1991. -fPIC) echo -KPIC -xcode=pic32 ;;
  1992. -W*,*) echo $flag ;;
  1993. -f*-*|-W*) ;;
  1994. *) echo $flag ;;
  1995. esac
  1996. done
  1997. }
  1998. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  1999. cc_type=pathscale
  2000. cc_version=__PATHSCALE__
  2001. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2002. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2003. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2004. speed_cflags='-O2'
  2005. size_cflags='-Os'
  2006. filter_cflags='filter_out -Wdisabled-optimization'
  2007. elif $cc -v 2>&1 | grep -q Open64; then
  2008. cc_type=open64
  2009. cc_version=__OPEN64__
  2010. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2011. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2012. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2013. speed_cflags='-O2'
  2014. size_cflags='-Os'
  2015. filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2016. fi
  2017. test -n "$cc_type" && enable $cc_type ||
  2018. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2019. : ${as_default:=$cc}
  2020. : ${dep_cc_default:=$cc}
  2021. : ${ld_default:=$cc}
  2022. set_default ar as dep_cc ld
  2023. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  2024. test -n "$CXX_DEPFLAGS" || CXXDEP=$DEPEND_CMD
  2025. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  2026. add_cflags $extra_cflags
  2027. add_cxxflags $extra_cxxflags
  2028. add_asflags $extra_cflags
  2029. if test -n "$sysroot"; then
  2030. case "$cc_type" in
  2031. gcc|llvm_gcc|clang)
  2032. add_cppflags --sysroot="$sysroot"
  2033. add_ldflags --sysroot="$sysroot"
  2034. ;;
  2035. tms470)
  2036. add_cppflags -I"$sysinclude"
  2037. add_ldflags --sysroot="$sysroot"
  2038. ;;
  2039. esac
  2040. fi
  2041. if test "$cpu" = host; then
  2042. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2043. case "$cc_type" in
  2044. gcc|llvm_gcc)
  2045. check_native(){
  2046. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2047. sed -n "/cc1.*$1=/{
  2048. s/.*$1=\\([^ ]*\\).*/\\1/
  2049. p
  2050. q
  2051. }" $TMPE
  2052. }
  2053. cpu=$(check_native -march || check_native -mcpu)
  2054. ;;
  2055. esac
  2056. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2057. fi
  2058. # Deal with common $arch aliases
  2059. case "$arch" in
  2060. arm*)
  2061. arch="arm"
  2062. ;;
  2063. mips|mipsel|IP*)
  2064. arch="mips"
  2065. ;;
  2066. mips64*)
  2067. arch="mips"
  2068. subarch="mips64"
  2069. ;;
  2070. parisc|hppa)
  2071. arch="parisc"
  2072. ;;
  2073. parisc64|hppa64)
  2074. arch="parisc"
  2075. subarch="parisc64"
  2076. ;;
  2077. "Power Macintosh"|ppc|powerpc|ppc64|powerpc64)
  2078. arch="ppc"
  2079. ;;
  2080. s390|s390x)
  2081. arch="s390"
  2082. ;;
  2083. sh4|sh)
  2084. arch="sh4"
  2085. ;;
  2086. sun4u|sparc64)
  2087. arch="sparc"
  2088. subarch="sparc64"
  2089. ;;
  2090. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2091. arch="x86"
  2092. ;;
  2093. esac
  2094. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2095. enable $arch
  2096. # Add processor-specific flags
  2097. if test "$cpu" = generic; then
  2098. : do nothing
  2099. elif enabled ppc; then
  2100. case $(tolower $cpu) in
  2101. 601|ppc601|powerpc601)
  2102. cpuflags="-mcpu=601"
  2103. disable altivec
  2104. ;;
  2105. 603*|ppc603*|powerpc603*)
  2106. cpuflags="-mcpu=603"
  2107. disable altivec
  2108. ;;
  2109. 604*|ppc604*|powerpc604*)
  2110. cpuflags="-mcpu=604"
  2111. disable altivec
  2112. ;;
  2113. g3|75*|ppc75*|powerpc75*)
  2114. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2115. disable altivec
  2116. ;;
  2117. g4|745*|ppc745*|powerpc745*)
  2118. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2119. ;;
  2120. 74*|ppc74*|powerpc74*)
  2121. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2122. ;;
  2123. g5|970|ppc970|powerpc970|power4*)
  2124. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2125. ;;
  2126. cell)
  2127. cpuflags="-mcpu=cell"
  2128. enable ldbrx
  2129. ;;
  2130. e500v2)
  2131. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2132. disable altivec
  2133. ;;
  2134. e500)
  2135. cpuflags="-mcpu=8540 -mhard-float"
  2136. disable altivec
  2137. ;;
  2138. esac
  2139. elif enabled x86; then
  2140. case $cpu in
  2141. i[345]86|pentium)
  2142. cpuflags="-march=$cpu"
  2143. disable mmx
  2144. ;;
  2145. # targets that do NOT support conditional mov (cmov)
  2146. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2147. cpuflags="-march=$cpu"
  2148. disable cmov
  2149. ;;
  2150. # targets that do support conditional mov (cmov)
  2151. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
  2152. cpuflags="-march=$cpu"
  2153. enable cmov
  2154. enable fast_cmov
  2155. ;;
  2156. # targets that do support conditional mov but on which it's slow
  2157. pentium4|pentium4m|prescott|nocona)
  2158. cpuflags="-march=$cpu"
  2159. enable cmov
  2160. disable fast_cmov
  2161. ;;
  2162. esac
  2163. elif enabled sparc; then
  2164. case $cpu in
  2165. niagara)
  2166. cpuflags="-mcpu=$cpu"
  2167. disable vis
  2168. ;;
  2169. sparc64)
  2170. cpuflags="-mcpu=v9"
  2171. ;;
  2172. esac
  2173. elif enabled arm; then
  2174. case $cpu in
  2175. armv*)
  2176. cpuflags="-march=$cpu"
  2177. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2178. ;;
  2179. *)
  2180. cpuflags="-mcpu=$cpu"
  2181. case $cpu in
  2182. cortex-a*) subarch=armv7a ;;
  2183. cortex-r*) subarch=armv7r ;;
  2184. cortex-m*) enable thumb; subarch=armv7m ;;
  2185. arm11*) subarch=armv6 ;;
  2186. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2187. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2188. esac
  2189. ;;
  2190. esac
  2191. elif enabled alpha; then
  2192. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2193. elif enabled bfin; then
  2194. cpuflags="-mcpu=$cpu"
  2195. elif enabled mips; then
  2196. cpuflags="-march=$cpu"
  2197. elif enabled avr32; then
  2198. case $cpu in
  2199. ap7[02]0[0-2])
  2200. subarch="avr32_ap"
  2201. cpuflags="-mpart=$cpu"
  2202. ;;
  2203. ap)
  2204. subarch="avr32_ap"
  2205. cpuflags="-march=$cpu"
  2206. ;;
  2207. uc3[ab]*)
  2208. subarch="avr32_uc"
  2209. cpuflags="-mcpu=$cpu"
  2210. ;;
  2211. uc)
  2212. subarch="avr32_uc"
  2213. cpuflags="-march=$cpu"
  2214. ;;
  2215. esac
  2216. fi
  2217. add_cflags $cpuflags
  2218. add_asflags $cpuflags
  2219. # compiler sanity check
  2220. check_exec <<EOF
  2221. int main(void){ return 0; }
  2222. EOF
  2223. if test "$?" != 0; then
  2224. echo "$cc is unable to create an executable file."
  2225. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2226. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2227. echo "Only do this if you know what cross compiling means."
  2228. fi
  2229. die "C compiler test failed."
  2230. fi
  2231. add_cppflags -D_ISOC99_SOURCE
  2232. add_cxxflags -D__STDC_CONSTANT_MACROS
  2233. check_cflags -std=c99
  2234. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2235. #include <stdlib.h>
  2236. EOF
  2237. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2238. #include <stdlib.h>
  2239. EOF
  2240. check_host_cflags -std=c99
  2241. check_host_cflags -Wall
  2242. case "$arch" in
  2243. alpha|ia64|mips|parisc|sparc)
  2244. spic=$shared
  2245. ;;
  2246. x86)
  2247. subarch="x86_32"
  2248. check_cc <<EOF && subarch="x86_64"
  2249. int test[(int)sizeof(char*) - 7];
  2250. EOF
  2251. if test "$subarch" = "x86_64"; then
  2252. spic=$shared
  2253. fi
  2254. ;;
  2255. ppc)
  2256. check_cc <<EOF && subarch="ppc64"
  2257. int test[(int)sizeof(char*) - 7];
  2258. EOF
  2259. ;;
  2260. esac
  2261. enable $subarch
  2262. enabled spic && enable pic
  2263. # OS specific
  2264. case $target_os in
  2265. haiku)
  2266. prefix_default="/boot/common"
  2267. network_extralibs="-lnetwork"
  2268. host_libs=
  2269. ;;
  2270. sunos)
  2271. FFSERVERLDFLAGS=""
  2272. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2273. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2274. network_extralibs="-lsocket -lnsl"
  2275. add_cppflags -D__EXTENSIONS__
  2276. # When using suncc to build, the Solaris linker will mark
  2277. # an executable with each instruction set encountered by
  2278. # the Solaris assembler. As our libraries contain their own
  2279. # guards for processor-specific code, instead suppress
  2280. # generation of the HWCAPS ELF section on Solaris x86 only.
  2281. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2282. nm_opts='-P -g'
  2283. ;;
  2284. netbsd)
  2285. disable symver
  2286. oss_indev_extralibs="-lossaudio"
  2287. oss_outdev_extralibs="-lossaudio"
  2288. ;;
  2289. openbsd)
  2290. enable malloc_aligned
  2291. # On OpenBSD 4.5. the compiler does not use PIC unless
  2292. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2293. # however the generated executable will not do anything
  2294. # (simply quits with exit-code 1, no crash, no output).
  2295. # Thus explicitly enable PIC here.
  2296. enable pic
  2297. disable symver
  2298. SHFLAGS='-shared'
  2299. oss_indev_extralibs="-lossaudio"
  2300. oss_outdev_extralibs="-lossaudio"
  2301. ;;
  2302. dragonfly)
  2303. enable malloc_aligned
  2304. disable symver
  2305. ;;
  2306. freebsd)
  2307. enable malloc_aligned
  2308. ;;
  2309. bsd/os)
  2310. add_extralibs -lpoll -lgnugetopt
  2311. strip="strip -d"
  2312. ;;
  2313. darwin)
  2314. enable malloc_aligned
  2315. gas="gas-preprocessor.pl $cc"
  2316. enabled ppc && add_asflags -force_cpusubtype_ALL
  2317. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2318. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2319. strip="${strip} -x"
  2320. add_ldflags -Wl,-dynamic,-search_paths_first
  2321. SLIBSUF=".dylib"
  2322. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2323. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2324. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2325. objformat="macho"
  2326. enabled x86_64 && objformat="macho64"
  2327. enabled_any pic shared ||
  2328. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2329. ;;
  2330. mingw32*)
  2331. if test $target_os = "mingw32ce"; then
  2332. disable network
  2333. else
  2334. target_os=mingw32
  2335. fi
  2336. LIBTARGET=i386
  2337. if enabled x86_64; then
  2338. enable malloc_aligned
  2339. LIBTARGET=x64
  2340. elif enabled arm; then
  2341. LIBTARGET=arm-wince
  2342. fi
  2343. shlibdir_default="$bindir_default"
  2344. SLIBPREF=""
  2345. SLIBSUF=".dll"
  2346. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2347. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2348. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2349. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2350. SLIB_INSTALL_LINKS=
  2351. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2352. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2353. 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'
  2354. objformat="win32"
  2355. enable dos_paths
  2356. check_cflags -fno-common
  2357. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2358. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2359. die "ERROR: MinGW runtime version must be >= 3.15."
  2360. add_cppflags -U__STRICT_ANSI__
  2361. ;;
  2362. cygwin*)
  2363. target_os=cygwin
  2364. shlibdir_default="$bindir_default"
  2365. SLIBPREF="cyg"
  2366. SLIBSUF=".dll"
  2367. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2368. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2369. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2370. objformat="win32"
  2371. enable dos_paths
  2372. check_cflags -fno-common
  2373. add_cppflags -U__STRICT_ANSI__
  2374. ;;
  2375. *-dos|freedos|opendos)
  2376. network_extralibs="-lsocket"
  2377. objformat="coff"
  2378. enable dos_paths
  2379. add_cppflags -U__STRICT_ANSI__
  2380. ;;
  2381. linux)
  2382. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2383. enable dv1394
  2384. ;;
  2385. irix*)
  2386. target_os=irix
  2387. ranlib="echo ignoring ranlib"
  2388. ;;
  2389. os/2*)
  2390. strip="lxlite -CS"
  2391. ln_s="cp -f"
  2392. objformat="aout"
  2393. add_cppflags -D_GNU_SOURCE
  2394. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2395. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2396. FFSERVERLDFLAGS=""
  2397. LIBSUF="_s.a"
  2398. SLIBPREF=""
  2399. SLIBSUF=".dll"
  2400. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2401. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2402. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2403. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2404. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2405. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2406. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2407. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2408. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2409. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2410. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2411. enable dos_paths
  2412. ;;
  2413. gnu/kfreebsd)
  2414. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2415. ;;
  2416. gnu)
  2417. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2418. ;;
  2419. qnx)
  2420. add_cppflags -D_QNX_SOURCE
  2421. network_extralibs="-lsocket"
  2422. ;;
  2423. symbian)
  2424. SLIBSUF=".dll"
  2425. enable dos_paths
  2426. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2427. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2428. add_ldflags -Wl,--target1-abs,--no-undefined \
  2429. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2430. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2431. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2432. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2433. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2434. ;;
  2435. none)
  2436. ;;
  2437. *)
  2438. die "Unknown OS '$target_os'."
  2439. ;;
  2440. esac
  2441. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
  2442. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2443. set_default $PATHS_LIST
  2444. # we need to build at least one lib type
  2445. if ! enabled_any static shared; then
  2446. cat <<EOF
  2447. At least one library type must be built.
  2448. Specify --enable-static to build the static libraries or --enable-shared to
  2449. build the shared libraries as well. To only build the shared libraries specify
  2450. --disable-static in addition to --enable-shared.
  2451. EOF
  2452. exit 1;
  2453. fi
  2454. die_license_disabled() {
  2455. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2456. }
  2457. die_license_disabled gpl libcdio
  2458. die_license_disabled gpl libx264
  2459. die_license_disabled gpl libxavs
  2460. die_license_disabled gpl libxvid
  2461. die_license_disabled gpl x11grab
  2462. die_license_disabled nonfree libaacplus
  2463. die_license_disabled nonfree libfaac
  2464. die_license_disabled version3 libopencore_amrnb
  2465. die_license_disabled version3 libopencore_amrwb
  2466. die_license_disabled version3 libvo_aacenc
  2467. die_license_disabled version3 libvo_amrwbenc
  2468. ! enabled gpl && enabled version2 && die "LGPLv2 mode is unsupported"
  2469. enabled version3 && enabled version2 && ! enabled nonfree && die "GPLv2 (not v2+) and GPLv3 without --enable-nonfree"
  2470. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2471. enabled version2 && enabled gpl && enable gplv2
  2472. disabled optimizations || check_cflags -fomit-frame-pointer
  2473. enable_pic() {
  2474. enable pic
  2475. add_cppflags -DPIC
  2476. add_cflags -fPIC
  2477. add_asflags -fPIC
  2478. }
  2479. enabled pic && enable_pic
  2480. check_cc <<EOF || die "Symbol mangling check failed."
  2481. int ff_extern;
  2482. EOF
  2483. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2484. extern_prefix=${sym%%ff_extern*}
  2485. check_cc <<EOF && enable inline_asm
  2486. void foo(void) { __asm__ volatile ("" ::); }
  2487. EOF
  2488. _restrict=
  2489. for restrict_keyword in restrict __restrict__ __restrict; do
  2490. check_cc <<EOF && _restrict=$restrict_keyword && break
  2491. void foo(char * $restrict_keyword p);
  2492. EOF
  2493. done
  2494. check_cc <<EOF && enable attribute_packed
  2495. struct { int x; } __attribute__((packed)) x;
  2496. EOF
  2497. check_cc <<EOF && enable attribute_may_alias
  2498. union { int x; } __attribute__((may_alias)) x;
  2499. EOF
  2500. check_cc <<EOF || die "endian test failed"
  2501. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2502. EOF
  2503. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2504. if enabled alpha; then
  2505. check_cflags -mieee
  2506. elif enabled arm; then
  2507. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2508. nogas=die
  2509. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2510. enable vfp_args
  2511. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2512. case "${cross_prefix:-$cc}" in
  2513. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2514. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2515. __asm__ (".eabi_attribute 28, 1");
  2516. int main(void) { return 0; }
  2517. EOF
  2518. esac
  2519. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2520. fi
  2521. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2522. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2523. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2524. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2525. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2526. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2527. enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2528. check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2529. enabled_all armv6t2 shared !pic && enable_pic
  2530. elif enabled mips; then
  2531. check_asm loongson '"dmult.g $1, $2, $3"'
  2532. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2533. elif enabled ppc; then
  2534. enable local_aligned_8 local_aligned_16
  2535. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2536. check_asm ibm_asm '"add 0, 0, 0"'
  2537. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2538. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2539. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2540. if enabled altivec; then
  2541. nogas=warn
  2542. check_cflags -maltivec -mabi=altivec &&
  2543. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2544. check_cflags -faltivec
  2545. # check if our compiler supports Motorola AltiVec C API
  2546. check_cc <<EOF || disable altivec
  2547. $inc_altivec_h
  2548. int main(void) {
  2549. vector signed int v1, v2, v3;
  2550. v1 = vec_add(v2,v3);
  2551. return 0;
  2552. }
  2553. EOF
  2554. # check if our compiler supports braces for vector declarations
  2555. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2556. $inc_altivec_h
  2557. int main (void) { (vector int) {1}; return 0; }
  2558. EOF
  2559. fi
  2560. elif enabled sparc; then
  2561. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2562. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2563. elif enabled x86; then
  2564. enable local_aligned_8 local_aligned_16
  2565. # check whether EBP is available on x86
  2566. # As 'i' is stored on the stack, this program will crash
  2567. # if the base pointer is used to access it because the
  2568. # base pointer is cleared in the inline assembly code.
  2569. check_exec_crash <<EOF && enable ebp_available
  2570. volatile int i=0;
  2571. __asm__ volatile (
  2572. "xorl %%ebp, %%ebp"
  2573. ::: "%ebp");
  2574. return i;
  2575. EOF
  2576. # check whether EBX is available on x86
  2577. check_asm ebx_available '""::"b"(0)' &&
  2578. check_asm ebx_available '"":::"%ebx"'
  2579. # check whether xmm clobbers are supported
  2580. check_asm xmm_clobbers '"":::"%xmm0"'
  2581. # check whether binutils is new enough to compile SSSE3/MMX2
  2582. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2583. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2584. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2585. if ! disabled_any asm mmx yasm; then
  2586. if check_cmd $yasmexe --version; then
  2587. enabled x86_64 && yasm_extra="-m amd64"
  2588. yasm_debug="-g dwarf2"
  2589. elif check_cmd nasm -v; then
  2590. yasmexe=nasm
  2591. yasm_debug="-g -F dwarf"
  2592. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2593. fi
  2594. YASMFLAGS="-f $objformat $yasm_extra"
  2595. enabled pic && append YASMFLAGS "-DPIC"
  2596. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2597. case "$objformat" in
  2598. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2599. esac
  2600. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2601. die "yasm not found, use --disable-yasm for a crippled build"
  2602. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
  2603. fi
  2604. case "$cpu" in
  2605. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2606. disable fast_clz
  2607. ;;
  2608. esac
  2609. fi
  2610. if enabled asm; then
  2611. as=${gas:=$as}
  2612. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2613. $nogas "GNU assembler not found, install gas-preprocessor"
  2614. fi
  2615. check_ldflags -Wl,--as-needed
  2616. if check_func dlopen; then
  2617. ldl=
  2618. elif check_func dlopen -ldl; then
  2619. ldl=-ldl
  2620. fi
  2621. if enabled network; then
  2622. check_type "sys/types.h sys/socket.h" socklen_t
  2623. check_type netdb.h "struct addrinfo"
  2624. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2625. check_type netinet/in.h "struct sockaddr_in6"
  2626. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2627. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2628. # Prefer arpa/inet.h over winsock2
  2629. if check_header arpa/inet.h ; then
  2630. check_func closesocket
  2631. elif check_header winsock2.h ; then
  2632. check_func_headers winsock2.h closesocket -lws2 && \
  2633. network_extralibs="-lws2" || \
  2634. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2635. network_extralibs="-lws2_32"; }
  2636. check_type ws2tcpip.h socklen_t
  2637. check_type ws2tcpip.h "struct addrinfo"
  2638. check_type ws2tcpip.h "struct ipv6_mreq"
  2639. check_type ws2tcpip.h "struct sockaddr_in6"
  2640. check_type ws2tcpip.h "struct sockaddr_storage"
  2641. check_struct winsock2.h "struct sockaddr" sa_len
  2642. else
  2643. disable network
  2644. fi
  2645. fi
  2646. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2647. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2648. check_func fcntl
  2649. check_func fork
  2650. check_func getaddrinfo $network_extralibs
  2651. check_func gethrtime
  2652. check_func getrusage
  2653. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2654. check_func inet_aton $network_extralibs
  2655. check_func isatty
  2656. check_func localtime_r
  2657. check_func ${malloc_prefix}memalign && enable memalign
  2658. check_func mkstemp
  2659. check_func mmap
  2660. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2661. check_func setrlimit
  2662. check_func strerror_r
  2663. check_func strptime
  2664. check_func strtok_r
  2665. check_func_headers conio.h kbhit
  2666. check_func_headers windows.h PeekNamedPipe
  2667. check_func_headers io.h setmode
  2668. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2669. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2670. check_func_headers windows.h GetProcessTimes
  2671. check_func_headers windows.h MapViewOfFile
  2672. check_func_headers windows.h VirtualAlloc
  2673. check_header dlfcn.h
  2674. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  2675. check_header libcrystalhd/libcrystalhd_if.h
  2676. check_header malloc.h
  2677. check_header poll.h
  2678. check_header sys/mman.h
  2679. check_header sys/resource.h
  2680. check_header sys/select.h
  2681. check_header termios.h
  2682. check_header vdpau/vdpau.h
  2683. check_header vdpau/vdpau_x11.h
  2684. check_header X11/extensions/XvMClib.h
  2685. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2686. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2687. # check for some common methods of building with pthread support
  2688. # do this before the optional library checks as some of them require pthreads
  2689. if ! disabled pthreads && ! enabled w32threads; then
  2690. enable pthreads
  2691. if check_func pthread_create; then
  2692. :
  2693. elif check_func pthread_create -pthread; then
  2694. add_cflags -pthread
  2695. add_extralibs -pthread
  2696. elif check_func pthread_create -pthreads; then
  2697. add_cflags -pthreads
  2698. add_extralibs -pthreads
  2699. elif check_func pthread_create -lpthreadGC2; then
  2700. add_extralibs -lpthreadGC2
  2701. elif ! check_lib pthread.h pthread_create -lpthread; then
  2702. disable pthreads
  2703. fi
  2704. fi
  2705. for thread in $THREADS_LIST; do
  2706. if enabled $thread; then
  2707. test -n "$thread_type" &&
  2708. die "ERROR: Only one thread type must be selected." ||
  2709. thread_type="$thread"
  2710. fi
  2711. done
  2712. check_lib math.h sin -lm && LIBM="-lm"
  2713. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  2714. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  2715. check_mathfunc exp2
  2716. check_mathfunc exp2f
  2717. check_mathfunc llrint
  2718. check_mathfunc llrintf
  2719. check_mathfunc log2
  2720. check_mathfunc log2f
  2721. check_mathfunc lrint
  2722. check_mathfunc lrintf
  2723. check_mathfunc round
  2724. check_mathfunc roundf
  2725. check_mathfunc trunc
  2726. check_mathfunc truncf
  2727. # these are off by default, so fail if requested and not available
  2728. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2729. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0
  2730. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2731. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  2732. enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
  2733. enabled libdirac && require_pkg_config dirac \
  2734. "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
  2735. "dirac_decoder_init dirac_encoder_init"
  2736. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2737. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  2738. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2739. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2740. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2741. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2742. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2743. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  2744. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2745. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2746. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2747. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2748. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  2749. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  2750. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder
  2751. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2752. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2753. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  2754. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2755. enabled libvpx && {
  2756. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2757. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2758. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  2759. die "ERROR: libvpx encoder version must be >=0.9.6"; } }
  2760. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2761. { check_cpp_condition x264.h "X264_BUILD >= 115" ||
  2762. die "ERROR: libx264 version must be >= 0.115."; }
  2763. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2764. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2765. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  2766. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  2767. die "ERROR: openal not found"; } &&
  2768. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  2769. die "ERROR: openal version must be 1.1 or compatible"; }
  2770. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2771. SDL_CONFIG="${cross_prefix}sdl-config"
  2772. if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
  2773. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2774. enable sdl &&
  2775. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2776. else
  2777. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2778. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2779. sdl_libs=$("${SDL_CONFIG}" --libs)
  2780. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  2781. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2782. enable sdl &&
  2783. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2784. fi
  2785. fi
  2786. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  2787. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2788. check_header linux/fb.h
  2789. check_header linux/videodev.h
  2790. check_header linux/videodev2.h
  2791. check_header sys/videoio.h
  2792. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2793. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2794. # w32api 3.12 had it defined wrong
  2795. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2796. check_type "dshow.h" IBaseFilter
  2797. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2798. { check_header dev/bktr/ioctl_meteor.h &&
  2799. check_header dev/bktr/ioctl_bt848.h; } ||
  2800. { check_header machine/ioctl_meteor.h &&
  2801. check_header machine/ioctl_bt848.h; } ||
  2802. { check_header dev/video/meteor/ioctl_meteor.h &&
  2803. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2804. check_header dev/ic/bt8xx.h
  2805. check_header sndio.h
  2806. if check_struct sys/soundcard.h audio_buf_info bytes; then
  2807. enable_safe sys/soundcard.h
  2808. else
  2809. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  2810. #include <sys/soundcard.h>
  2811. audio_buf_info abc;
  2812. EOF
  2813. fi
  2814. check_header soundcard.h
  2815. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2816. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait
  2817. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  2818. enabled libcdio &&
  2819. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  2820. enabled x11grab &&
  2821. check_header X11/Xlib.h &&
  2822. check_header X11/extensions/XShm.h &&
  2823. check_header X11/extensions/Xfixes.h &&
  2824. check_func XOpenDisplay -lX11 &&
  2825. check_func XShmCreateImage -lX11 -lXext &&
  2826. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2827. if ! disabled vaapi; then
  2828. check_lib va/va.h vaInitialize -lva && {
  2829. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  2830. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  2831. } || disable vaapi
  2832. fi
  2833. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2834. check_cpp_condition \
  2835. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2836. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2837. disable vdpau; }
  2838. fi
  2839. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2840. # add some useful compiler flags if supported
  2841. check_cflags -Wdeclaration-after-statement
  2842. check_cflags -Wall
  2843. check_cflags -Wno-parentheses
  2844. check_cflags -Wno-switch
  2845. check_cflags -Wno-format-zero-length
  2846. check_cflags -Wdisabled-optimization
  2847. check_cflags -Wpointer-arith
  2848. check_cflags -Wredundant-decls
  2849. check_cflags -Wno-pointer-sign
  2850. check_cflags -Wcast-qual
  2851. check_cflags -Wwrite-strings
  2852. check_cflags -Wtype-limits
  2853. check_cflags -Wundef
  2854. check_cflags -Wmissing-prototypes
  2855. check_cflags -Wno-pointer-to-int-cast
  2856. enabled extra_warnings && check_cflags -Winline
  2857. # add some linker flags
  2858. check_ldflags -Wl,--warn-common
  2859. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
  2860. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2861. echo "X{};" > $TMPV
  2862. if test_ldflags -Wl,--version-script,$TMPV; then
  2863. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2864. check_cc <<EOF && enable symver_asm_label
  2865. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2866. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2867. EOF
  2868. check_cc <<EOF && enable symver_gnu_asm
  2869. __asm__(".symver ff_foo,av_foo@VERSION");
  2870. void ff_foo(void) {}
  2871. EOF
  2872. fi
  2873. if [ -n "$optflags" ]; then
  2874. add_cflags $optflags
  2875. elif enabled small; then
  2876. add_cflags $size_cflags
  2877. elif enabled optimizations; then
  2878. add_cflags $speed_cflags
  2879. else
  2880. add_cflags $noopt_cflags
  2881. fi
  2882. check_cflags -fno-math-errno
  2883. check_cflags -fno-signed-zeros
  2884. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  2885. int x;
  2886. EOF
  2887. if enabled icc; then
  2888. # Just warnings, no remarks
  2889. check_cflags -w1
  2890. # -wd: Disable following warnings
  2891. # 144, 167, 556: -Wno-pointer-sign
  2892. # 1292: attribute "foo" ignored
  2893. # 10006: ignoring unknown option -fno-signed-zeros
  2894. # 10148: ignoring unknown option -Wno-parentheses
  2895. # 10156: ignoring option '-W'; no argument required
  2896. check_cflags -wd144,167,556,1292,10006,10148,10156
  2897. # 11030: Warning unknown option --as-needed
  2898. # 10156: ignoring option '-export'; no argument required
  2899. check_ldflags -wd10156,11030
  2900. # Allow to compile with optimizations
  2901. check_ldflags -march=$cpu
  2902. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2903. enable ebp_available
  2904. if enabled x86_32; then
  2905. test ${icc_version%%.*} -ge 11 && \
  2906. check_cflags -falign-stack=maintain-16-byte || \
  2907. disable aligned_stack
  2908. fi
  2909. elif enabled ccc; then
  2910. # disable some annoying warnings
  2911. add_cflags -msg_disable cvtu32to64
  2912. add_cflags -msg_disable embedcomment
  2913. add_cflags -msg_disable needconstext
  2914. add_cflags -msg_disable nomainieee
  2915. add_cflags -msg_disable ptrmismatch1
  2916. add_cflags -msg_disable unreachcode
  2917. elif enabled gcc; then
  2918. check_cflags -fno-tree-vectorize
  2919. check_cflags -Werror=implicit-function-declaration
  2920. check_cflags -Werror=missing-prototypes
  2921. elif enabled llvm_gcc; then
  2922. check_cflags -mllvm -stack-alignment=16
  2923. elif enabled clang; then
  2924. check_cflags -mllvm -stack-alignment=16
  2925. check_cflags -Qunused-arguments
  2926. elif enabled armcc; then
  2927. # 2523: use of inline assembler is deprecated
  2928. add_cflags -W${armcc_opt},--diag_suppress=2523
  2929. add_cflags -W${armcc_opt},--diag_suppress=1207
  2930. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2931. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2932. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  2933. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  2934. elif enabled tms470; then
  2935. add_cflags -pds=824 -pds=837
  2936. elif enabled pathscale; then
  2937. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2938. fi
  2939. enabled_any $THREADS_LIST && enable threads
  2940. check_deps $CONFIG_LIST \
  2941. $CONFIG_EXTRA \
  2942. $HAVE_LIST \
  2943. $DECODER_LIST \
  2944. $ENCODER_LIST \
  2945. $HWACCEL_LIST \
  2946. $PARSER_LIST \
  2947. $BSF_LIST \
  2948. $DEMUXER_LIST \
  2949. $MUXER_LIST \
  2950. $FILTER_LIST \
  2951. $INDEV_LIST \
  2952. $OUTDEV_LIST \
  2953. $PROTOCOL_LIST \
  2954. $ACODEC_TESTS \
  2955. $VCODEC_TESTS \
  2956. $LAVF_TESTS \
  2957. $LAVFI_TESTS \
  2958. $SEEK_TESTS \
  2959. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2960. if test $target_os = "haiku"; then
  2961. disable memalign
  2962. disable posix_memalign
  2963. fi
  2964. ! enabled_any memalign posix_memalign malloc_aligned &&
  2965. enabled_any $need_memalign && enable memalign_hack
  2966. echo "install prefix $prefix"
  2967. echo "source path $source_path"
  2968. echo "C compiler $cc"
  2969. echo "ARCH $arch ($cpu)"
  2970. if test "$build_suffix" != ""; then
  2971. echo "build suffix $build_suffix"
  2972. fi
  2973. if test "$progs_suffix" != ""; then
  2974. echo "progs suffix $progs_suffix"
  2975. fi
  2976. if test "$extra_version" != ""; then
  2977. echo "version string suffix $extra_version"
  2978. fi
  2979. echo "big-endian ${bigendian-no}"
  2980. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2981. if enabled x86; then
  2982. echo "${yasmexe} ${yasm-no}"
  2983. echo "MMX enabled ${mmx-no}"
  2984. echo "MMX2 enabled ${mmx2-no}"
  2985. echo "3DNow! enabled ${amd3dnow-no}"
  2986. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2987. echo "SSE enabled ${sse-no}"
  2988. echo "SSSE3 enabled ${ssse3-no}"
  2989. echo "AVX enabled ${avx-no}"
  2990. echo "CMOV enabled ${cmov-no}"
  2991. echo "CMOV is fast ${fast_cmov-no}"
  2992. echo "EBX available ${ebx_available-no}"
  2993. echo "EBP available ${ebp_available-no}"
  2994. fi
  2995. if enabled arm; then
  2996. echo "ARMv5TE enabled ${armv5te-no}"
  2997. echo "ARMv6 enabled ${armv6-no}"
  2998. echo "ARMv6T2 enabled ${armv6t2-no}"
  2999. echo "ARM VFP enabled ${armvfp-no}"
  3000. echo "IWMMXT enabled ${iwmmxt-no}"
  3001. echo "NEON enabled ${neon-no}"
  3002. fi
  3003. if enabled mips; then
  3004. echo "MMI enabled ${mmi-no}"
  3005. fi
  3006. if enabled ppc; then
  3007. echo "AltiVec enabled ${altivec-no}"
  3008. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3009. echo "dcbzl available ${dcbzl-no}"
  3010. fi
  3011. if enabled sparc; then
  3012. echo "VIS enabled ${vis-no}"
  3013. fi
  3014. echo "debug symbols ${debug-no}"
  3015. echo "strip symbols ${stripping-no}"
  3016. echo "optimize for size ${small-no}"
  3017. echo "optimizations ${optimizations-no}"
  3018. echo "static ${static-no}"
  3019. echo "shared ${shared-no}"
  3020. echo "postprocessing support ${postproc-no}"
  3021. echo "new filter support ${avfilter-no}"
  3022. echo "network support ${network-no}"
  3023. echo "threading support ${thread_type-no}"
  3024. echo "SDL support ${sdl-no}"
  3025. echo "Sun medialib support ${mlib-no}"
  3026. echo "libdxva2 enabled ${dxva2-no}"
  3027. echo "libva enabled ${vaapi-no}"
  3028. echo "libvdpau enabled ${vdpau-no}"
  3029. echo "AVISynth enabled ${avisynth-no}"
  3030. echo "libcelt enabled ${libcelt-no}"
  3031. echo "frei0r enabled ${frei0r-no}"
  3032. echo "libcdio support ${libcdio-no}"
  3033. echo "libdc1394 support ${libdc1394-no}"
  3034. echo "libdirac enabled ${libdirac-no}"
  3035. echo "libfaac enabled ${libfaac-no}"
  3036. echo "libaacplus enabled ${libaacplus-no}"
  3037. echo "libgsm enabled ${libgsm-no}"
  3038. echo "libmp3lame enabled ${libmp3lame-no}"
  3039. echo "libnut enabled ${libnut-no}"
  3040. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3041. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3042. echo "libopencv support ${libopencv-no}"
  3043. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3044. echo "librtmp enabled ${librtmp-no}"
  3045. echo "libschroedinger enabled ${libschroedinger-no}"
  3046. echo "libspeex enabled ${libspeex-no}"
  3047. echo "libstagefright-h264 enabled ${libstagefright_h264-no}"
  3048. echo "libtheora enabled ${libtheora-no}"
  3049. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3050. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3051. echo "libvorbis enabled ${libvorbis-no}"
  3052. echo "libvpx enabled ${libvpx-no}"
  3053. echo "libx264 enabled ${libx264-no}"
  3054. echo "libxavs enabled ${libxavs-no}"
  3055. echo "libxvid enabled ${libxvid-no}"
  3056. echo "openal enabled ${openal-no}"
  3057. echo "zlib enabled ${zlib-no}"
  3058. echo "bzlib enabled ${bzlib-no}"
  3059. echo
  3060. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3061. echo "Enabled ${type}s:"
  3062. eval list=\$$(toupper $type)_LIST
  3063. print_enabled '_*' $list | sort | pr -r -3 -t
  3064. echo
  3065. done
  3066. license="LGPL version 2.1 or later"
  3067. if enabled nonfree; then
  3068. license="nonfree and unredistributable"
  3069. elif enabled gplv3; then
  3070. license="GPL version 3 or later"
  3071. elif enabled gplv2; then
  3072. license="GPL version 2"
  3073. elif enabled lgplv3; then
  3074. license="LGPL version 3 or later"
  3075. elif enabled gpl; then
  3076. license="GPL version 2 or later"
  3077. fi
  3078. echo "License: $license"
  3079. echo "Creating config.mak and config.h..."
  3080. test -e Makefile || $ln_s "$source_path/Makefile" .
  3081. enabled stripping || strip="echo skipping strip"
  3082. config_files="$TMPH config.mak"
  3083. cat > config.mak <<EOF
  3084. # Automatically generated by configure - do not modify!
  3085. ifndef FFMPEG_CONFIG_MAK
  3086. FFMPEG_CONFIG_MAK=1
  3087. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  3088. prefix=$prefix
  3089. LIBDIR=\$(DESTDIR)$libdir
  3090. SHLIBDIR=\$(DESTDIR)$shlibdir
  3091. INCDIR=\$(DESTDIR)$incdir
  3092. BINDIR=\$(DESTDIR)$bindir
  3093. DATADIR=\$(DESTDIR)$datadir
  3094. MANDIR=\$(DESTDIR)$mandir
  3095. SRC_PATH=$source_path
  3096. ifndef MAIN_MAKEFILE
  3097. SRC_PATH:=\$(SRC_PATH:.%=..%)
  3098. endif
  3099. CC_IDENT=$cc_ident
  3100. ARCH=$arch
  3101. CC=$cc
  3102. CXX=$cxx
  3103. AS=$as
  3104. LD=$ld
  3105. DEPCC=$dep_cc
  3106. YASM=$yasmexe
  3107. YASMDEP=$yasmexe
  3108. AR=$ar
  3109. RANLIB=$ranlib
  3110. CP=cp -p
  3111. LN_S=$ln_s
  3112. STRIP=$strip
  3113. CPPFLAGS=$CPPFLAGS
  3114. CFLAGS=$CFLAGS
  3115. CXXFLAGS=$CXXFLAGS
  3116. ASFLAGS=$ASFLAGS
  3117. AS_O=$CC_O
  3118. CC_O=$CC_O
  3119. CXX_O=$CXX_O
  3120. LDFLAGS=$LDFLAGS
  3121. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  3122. SHFLAGS=$SHFLAGS
  3123. YASMFLAGS=$YASMFLAGS
  3124. BUILDSUF=$build_suffix
  3125. PROGSSUF=$progs_suffix
  3126. FULLNAME=$FULLNAME
  3127. LIBPREF=$LIBPREF
  3128. LIBSUF=$LIBSUF
  3129. LIBNAME=$LIBNAME
  3130. SLIBPREF=$SLIBPREF
  3131. SLIBSUF=$SLIBSUF
  3132. EXESUF=$EXESUF
  3133. EXTRA_VERSION=$extra_version
  3134. DEPFLAGS=$DEPFLAGS
  3135. CCDEP=$CCDEP
  3136. CXXDEP=$CXXDEP
  3137. ASDEP=$ASDEP
  3138. CC_DEPFLAGS=$CC_DEPFLAGS
  3139. AS_DEPFLAGS=$AS_DEPFLAGS
  3140. HOSTCC=$host_cc
  3141. HOSTCFLAGS=$host_cflags
  3142. HOSTEXESUF=$HOSTEXESUF
  3143. HOSTLDFLAGS=$host_ldflags
  3144. HOSTLIBS=$host_libs
  3145. TARGET_EXEC=$target_exec
  3146. TARGET_PATH=$target_path
  3147. SDL_LIBS=$sdl_libs
  3148. SDL_CFLAGS=$sdl_cflags
  3149. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3150. EXTRALIBS=$extralibs
  3151. INSTALL=$install
  3152. LIBTARGET=${LIBTARGET}
  3153. SLIBNAME=${SLIBNAME}
  3154. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3155. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3156. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3157. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3158. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3159. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3160. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3161. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3162. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  3163. NOREDZONE_FLAGS=$noredzone_flags
  3164. EOF
  3165. get_version(){
  3166. name=$1
  3167. file=$source_path/$2
  3168. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3169. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3170. lcname=$(tolower $name)
  3171. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3172. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3173. }
  3174. get_version LIBSWSCALE libswscale/swscale.h
  3175. get_version LIBSWRESAMPLE libswresample/swresample.h
  3176. get_version LIBPOSTPROC libpostproc/postprocess.h
  3177. get_version LIBAVCODEC libavcodec/version.h
  3178. get_version LIBAVDEVICE libavdevice/avdevice.h
  3179. get_version LIBAVFORMAT libavformat/version.h
  3180. get_version LIBAVUTIL libavutil/avutil.h
  3181. get_version LIBAVFILTER libavfilter/avfilter.h
  3182. cat > $TMPH <<EOF
  3183. /* Automatically generated by configure - do not modify! */
  3184. #ifndef FFMPEG_CONFIG_H
  3185. #define FFMPEG_CONFIG_H
  3186. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  3187. #define FFMPEG_LICENSE "$(c_escape $license)"
  3188. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  3189. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3190. #define CC_TYPE "$cc_type"
  3191. #define CC_VERSION $cc_version
  3192. #define restrict $_restrict
  3193. #define EXTERN_PREFIX "${extern_prefix}"
  3194. #define EXTERN_ASM ${extern_prefix}
  3195. #define SLIBSUF "$SLIBSUF"
  3196. EOF
  3197. test -n "$malloc_prefix" &&
  3198. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3199. if enabled small || disabled optimizations; then
  3200. echo "#undef av_always_inline" >> $TMPH
  3201. if enabled small; then
  3202. echo "#define av_always_inline inline" >> $TMPH
  3203. else
  3204. echo "#define av_always_inline av_unused" >> $TMPH
  3205. fi
  3206. fi
  3207. if enabled yasm; then
  3208. append config_files $TMPASM
  3209. printf '' >$TMPASM
  3210. fi
  3211. print_config ARCH_ "$config_files" $ARCH_LIST
  3212. print_config HAVE_ "$config_files" $HAVE_LIST
  3213. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3214. $CONFIG_EXTRA \
  3215. $DECODER_LIST \
  3216. $ENCODER_LIST \
  3217. $HWACCEL_LIST \
  3218. $PARSER_LIST \
  3219. $BSF_LIST \
  3220. $DEMUXER_LIST \
  3221. $MUXER_LIST \
  3222. $FILTER_LIST \
  3223. $PROTOCOL_LIST \
  3224. $INDEV_LIST \
  3225. $OUTDEV_LIST \
  3226. cat >>config.mak <<EOF
  3227. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3228. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3229. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3230. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3231. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3232. EOF
  3233. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  3234. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  3235. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3236. cp_if_changed $TMPH config.h
  3237. touch .config
  3238. enabled yasm && cp_if_changed $TMPASM config.asm
  3239. cat > $TMPH <<EOF
  3240. /* Generated by ffconf */
  3241. #ifndef AVUTIL_AVCONFIG_H
  3242. #define AVUTIL_AVCONFIG_H
  3243. EOF
  3244. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3245. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3246. cp_if_changed $TMPH libavutil/avconfig.h
  3247. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3248. # build pkg-config files
  3249. pkgconfig_generate(){
  3250. name=$1
  3251. shortname=${name#lib}${build_suffix}
  3252. comment=$2
  3253. version=$3
  3254. libs=$4
  3255. requires=$5
  3256. enabled ${name#lib} || return 0
  3257. mkdir -p $name
  3258. cat <<EOF > $name/$name.pc
  3259. prefix=$prefix
  3260. exec_prefix=\${prefix}
  3261. libdir=$libdir
  3262. includedir=$incdir
  3263. Name: $name
  3264. Description: $comment
  3265. Version: $version
  3266. Requires: $(enabled shared || echo $requires)
  3267. Requires.private: $(enabled shared && echo $requires)
  3268. Conflicts:
  3269. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3270. Libs.private: $(enabled shared && echo $libs)
  3271. Cflags: -I\${includedir}
  3272. EOF
  3273. cat <<EOF > $name/$name-uninstalled.pc
  3274. prefix=
  3275. exec_prefix=
  3276. libdir=\${pcfiledir}
  3277. includedir=${source_path}
  3278. Name: $name
  3279. Description: $comment
  3280. Version: $version
  3281. Requires: $requires
  3282. Conflicts:
  3283. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3284. Cflags: -I\${includedir}
  3285. EOF
  3286. }
  3287. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3288. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3289. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3290. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3291. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  3292. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3293. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
  3294. pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"