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.

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