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.

3702 lines
112KB

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