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.

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