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.

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