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.

3695 lines
111KB

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