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.

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