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.

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