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.

3757 lines
113KB

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