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.

3690 lines
111KB

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