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.

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