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.

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