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.

3706 lines
111KB

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