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.

3728 lines
112KB

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