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.

3679 lines
110KB

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