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.

3685 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. http_protocol_deps="network"
  1462. http_protocol_select="tcp_protocol"
  1463. https_protocol_select="tls_protocol"
  1464. mmsh_protocol_select="http_protocol"
  1465. mmst_protocol_deps="network"
  1466. rtmp_protocol_select="tcp_protocol"
  1467. rtp_protocol_select="udp_protocol"
  1468. tcp_protocol_deps="network"
  1469. tls_protocol_deps_any="openssl gnutls"
  1470. tls_protocol_select="tcp_protocol"
  1471. udp_protocol_deps="network"
  1472. # filters
  1473. amovie_filter_deps="avcodec avformat"
  1474. blackframe_filter_deps="gpl"
  1475. boxblur_filter_deps="gpl"
  1476. cropdetect_filter_deps="gpl"
  1477. delogo_filter_deps="gpl"
  1478. drawtext_filter_deps="libfreetype"
  1479. frei0r_filter_deps="frei0r dlopen"
  1480. frei0r_src_filter_deps="frei0r dlopen"
  1481. hqdn3d_filter_deps="gpl"
  1482. movie_filter_deps="avcodec avformat"
  1483. mp_filter_deps="gpl avcodec"
  1484. mptestsrc_filter_deps="gpl"
  1485. negate_filter_deps="lut_filter"
  1486. ocv_filter_deps="libopencv"
  1487. scale_filter_deps="swscale"
  1488. yadif_filter_deps="gpl"
  1489. # libraries
  1490. avdevice_deps="avcodec avformat"
  1491. avformat_deps="avcodec"
  1492. postproc_deps="gpl"
  1493. # programs
  1494. ffmpeg_deps="avcodec avformat swscale swresample"
  1495. ffmpeg_select="buffer_filter buffersink_filter"
  1496. avconv_deps="avcodec avformat swscale"
  1497. avconv_select="buffer_filter"
  1498. ffplay_deps="avcodec avformat swscale sdl"
  1499. ffplay_select="buffersink_filter rdft"
  1500. ffprobe_deps="avcodec avformat"
  1501. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1502. ffserver_extralibs='$ldl'
  1503. doc_deps="texi2html"
  1504. # tests
  1505. test_deps(){
  1506. suf1=$1
  1507. suf2=$2
  1508. shift 2
  1509. for v; do
  1510. dep=${v%=*}
  1511. tests=${v#*=}
  1512. for name in ${tests}; do
  1513. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1514. done
  1515. done
  1516. }
  1517. mxf_d10_test_deps="avfilter"
  1518. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1519. test_deps _encoder _decoder \
  1520. adpcm_g726=g726 \
  1521. adpcm_ima_qt \
  1522. adpcm_ima_wav \
  1523. adpcm_ms \
  1524. adpcm_swf \
  1525. adpcm_yamaha=adpcm_yam \
  1526. alac \
  1527. asv1 \
  1528. asv2 \
  1529. bmp \
  1530. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1531. dvvideo="dv dv50" \
  1532. ffv1 \
  1533. flac \
  1534. flashsv \
  1535. flv \
  1536. gif \
  1537. h261 \
  1538. h263="h263 h263p" \
  1539. huffyuv \
  1540. jpegls \
  1541. mjpeg="jpg mjpeg ljpeg" \
  1542. mp2 \
  1543. mpeg1video="mpeg mpeg1b" \
  1544. mpeg2video="mpeg2 mpeg2thread" \
  1545. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1546. msmpeg4v3=msmpeg4 \
  1547. msmpeg4v2 \
  1548. pbm=pbmpipe \
  1549. pcx \
  1550. pgm="pgm pgmpipe" \
  1551. png \
  1552. ppm="ppm ppmpipe" \
  1553. rawvideo="rgb yuv" \
  1554. roq \
  1555. rv10 \
  1556. rv20 \
  1557. sgi \
  1558. snow="snow snowll" \
  1559. svq1 \
  1560. targa=tga \
  1561. tiff \
  1562. wmav1 \
  1563. wmav2 \
  1564. wmv1 \
  1565. wmv2 \
  1566. test_deps _muxer _demuxer \
  1567. aiff \
  1568. pcm_alaw=alaw \
  1569. asf \
  1570. au \
  1571. avi \
  1572. dv=dv_fmt \
  1573. ffm \
  1574. flv=flv_fmt \
  1575. gxf \
  1576. matroska=mkv \
  1577. mmf \
  1578. mov \
  1579. pcm_mulaw=mulaw \
  1580. mxf="mxf mxf_d10" \
  1581. nut \
  1582. ogg \
  1583. rawvideo=pixfmt \
  1584. rm \
  1585. swf \
  1586. mpegts=ts \
  1587. voc \
  1588. wav \
  1589. yuv4mpegpipe=yuv4mpeg \
  1590. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
  1591. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1592. # default parameters
  1593. logfile="config.log"
  1594. # installation paths
  1595. prefix_default="/usr/local"
  1596. bindir_default='${prefix}/bin'
  1597. datadir_default='${prefix}/share/ffmpeg'
  1598. incdir_default='${prefix}/include'
  1599. libdir_default='${prefix}/lib'
  1600. mandir_default='${prefix}/share/man'
  1601. shlibdir_default="$libdir_default"
  1602. # toolchain
  1603. ar_default="ar"
  1604. cc_default="gcc"
  1605. cxx_default="g++"
  1606. cc_version=\"unknown\"
  1607. host_cc_default="gcc"
  1608. install="install"
  1609. ln_s="ln -sf"
  1610. nm_default="nm"
  1611. objformat="elf"
  1612. pkg_config_default=pkg-config
  1613. ranlib="ranlib"
  1614. strip_default="strip"
  1615. yasmexe="yasm"
  1616. nogas=":"
  1617. nm_opts='-g'
  1618. # machine
  1619. arch_default=$(uname -m)
  1620. cpu="generic"
  1621. # OS
  1622. target_os_default=$(tolower $(uname -s))
  1623. host_os=$target_os_default
  1624. # configurable options
  1625. enable avcodec
  1626. enable avdevice
  1627. enable avfilter
  1628. enable avformat
  1629. enable avutil
  1630. enable asm
  1631. enable debug
  1632. enable doc
  1633. enable fastdiv
  1634. enable ffmpeg
  1635. enable avconv
  1636. enable ffplay
  1637. enable ffprobe
  1638. enable ffserver
  1639. enable network
  1640. enable optimizations
  1641. enable postproc
  1642. enable protocols
  1643. enable static
  1644. enable stripping
  1645. enable swresample
  1646. enable swscale
  1647. enable swscale_alpha
  1648. # build settings
  1649. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1650. FFSERVERLDFLAGS=-Wl,-E
  1651. LIBPREF="lib"
  1652. LIBSUF=".a"
  1653. FULLNAME='$(NAME)$(BUILDSUF)'
  1654. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1655. SLIBPREF="lib"
  1656. SLIBSUF=".so"
  1657. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1658. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1659. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1660. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1661. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1662. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1663. AS_O='-o $@'
  1664. CC_O='-o $@'
  1665. CXX_O='-o $@'
  1666. host_cflags='-D_ISOC99_SOURCE -O3 -g'
  1667. host_libs='-lm'
  1668. target_path='$(CURDIR)'
  1669. # since the object filename is not given with the -MM flag, the compiler
  1670. # is only able to print the basename, and we must add the path ourselves
  1671. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1672. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1673. # find source path
  1674. if test -f configure; then
  1675. source_path=.
  1676. else
  1677. source_path=$(cd $(dirname "$0"); pwd)
  1678. echo "$source_path" | grep -q '[[:blank:]]' &&
  1679. die "Out of tree builds are impossible with whitespace in source path."
  1680. test -e "$source_path/config.h" &&
  1681. die "Out of tree builds are impossible with config.h in source dir."
  1682. fi
  1683. for v in "$@"; do
  1684. r=${v#*=}
  1685. l=${v%"$r"}
  1686. r=$(sh_quote "$r")
  1687. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1688. done
  1689. find_things(){
  1690. thing=$1
  1691. pattern=$2
  1692. file=$source_path/$3
  1693. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1694. }
  1695. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1696. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1697. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1698. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1699. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1700. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1701. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1702. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1703. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1704. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1705. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1706. find_tests(){
  1707. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1708. }
  1709. ACODEC_TESTS=$(find_tests acodec)
  1710. VCODEC_TESTS=$(find_tests vsynth1)
  1711. LAVF_TESTS=$(find_tests lavf)
  1712. LAVFI_TESTS=$(find_tests lavfi)
  1713. SEEK_TESTS=$(find_tests seek seek_)
  1714. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1715. for n in $COMPONENT_LIST; do
  1716. v=$(toupper ${n%s})_LIST
  1717. eval enable \$$v
  1718. eval ${n}_if_any="\$$v"
  1719. done
  1720. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
  1721. die_unknown(){
  1722. echo "Unknown option \"$1\"."
  1723. echo "See $0 --help for available options."
  1724. exit 1
  1725. }
  1726. show_list() {
  1727. suffix=_$1
  1728. shift
  1729. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1730. exit 0
  1731. }
  1732. for opt do
  1733. optval="${opt#*=}"
  1734. case "$opt" in
  1735. --extra-ldflags=*) add_ldflags $optval
  1736. ;;
  1737. --extra-libs=*) add_extralibs $optval
  1738. ;;
  1739. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1740. ;;
  1741. --enable-debug=*) debuglevel="$optval"
  1742. ;;
  1743. --disable-everything)
  1744. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1745. ;;
  1746. --enable-*=*|--disable-*=*)
  1747. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1748. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1749. eval list=\$$(toupper $thing)_LIST
  1750. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1751. $action $(filter "$name" $list)
  1752. ;;
  1753. --enable-?*|--disable-?*)
  1754. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1755. if is_in $option $COMPONENT_LIST; then
  1756. test $action = disable && action=unset
  1757. eval $action \$$(toupper ${option%s})_LIST
  1758. elif is_in $option $CMDLINE_SELECT; then
  1759. $action $option
  1760. else
  1761. die_unknown $opt
  1762. fi
  1763. ;;
  1764. --list-*)
  1765. NAME="${opt#--list-}"
  1766. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1767. NAME=${NAME%s}
  1768. eval show_list $NAME \$$(toupper $NAME)_LIST
  1769. ;;
  1770. --help|-h) show_help
  1771. ;;
  1772. *)
  1773. optname="${opt%%=*}"
  1774. optname="${optname#--}"
  1775. optname=$(echo "$optname" | sed 's/-/_/g')
  1776. if is_in $optname $CMDLINE_SET; then
  1777. eval $optname='$optval'
  1778. elif is_in $optname $CMDLINE_APPEND; then
  1779. append $optname "$optval"
  1780. else
  1781. die_unknown $opt
  1782. fi
  1783. ;;
  1784. esac
  1785. done
  1786. disabled logging && logfile=/dev/null
  1787. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1788. set >> $logfile
  1789. test -n "$cross_prefix" && enable cross_compile
  1790. if enabled cross_compile; then
  1791. test -n "$arch" && test -n "$target_os" ||
  1792. die "Must specify target arch and OS when cross-compiling"
  1793. fi
  1794. set_default arch target_os
  1795. ar_default="${cross_prefix}${ar_default}"
  1796. cc_default="${cross_prefix}${cc_default}"
  1797. cxx_default="${cross_prefix}${cxx_default}"
  1798. nm_default="${cross_prefix}${nm_default}"
  1799. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1800. ranlib="${cross_prefix}${ranlib}"
  1801. strip_default="${cross_prefix}${strip_default}"
  1802. sysinclude_default="${sysroot}/usr/include"
  1803. set_default cc cxx nm pkg_config strip sysinclude
  1804. enabled cross_compile || host_cc_default=$cc
  1805. set_default host_cc
  1806. if ! $pkg_config --version >/dev/null 2>&1; then
  1807. warn "$pkg_config not found, library detection may fail."
  1808. pkg_config=false
  1809. fi
  1810. exesuf() {
  1811. case $1 in
  1812. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1813. esac
  1814. }
  1815. EXESUF=$(exesuf $target_os)
  1816. HOSTEXESUF=$(exesuf $host_os)
  1817. # set temporary file name
  1818. : ${TMPDIR:=$TEMPDIR}
  1819. : ${TMPDIR:=$TMP}
  1820. : ${TMPDIR:=/tmp}
  1821. if ! check_cmd mktemp -u XXXXXX; then
  1822. # simple replacement for missing mktemp
  1823. # NOT SAFE FOR GENERAL USE
  1824. mktemp(){
  1825. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1826. }
  1827. fi
  1828. tmpfile(){
  1829. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1830. (set -C; exec > $tmp) 2>/dev/null ||
  1831. die "Unable to create temporary file in $TMPDIR."
  1832. append TMPFILES $tmp
  1833. eval $1=$tmp
  1834. }
  1835. trap 'rm -f -- $TMPFILES' EXIT
  1836. tmpfile TMPC .c
  1837. tmpfile TMPCPP .cpp
  1838. tmpfile TMPE $EXESUF
  1839. tmpfile TMPH .h
  1840. tmpfile TMPO .o
  1841. tmpfile TMPS .S
  1842. tmpfile TMPV .ver
  1843. tmpfile TMPSH .sh
  1844. tmpfile TMPASM .asm
  1845. unset -f mktemp
  1846. chmod +x $TMPE
  1847. # make sure we can execute files in $TMPDIR
  1848. cat > $TMPSH 2>> $logfile <<EOF
  1849. #! /bin/sh
  1850. EOF
  1851. chmod +x $TMPSH >> $logfile 2>&1
  1852. if ! $TMPSH >> $logfile 2>&1; then
  1853. cat <<EOF
  1854. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1855. variable to another directory and make sure that it is not mounted noexec.
  1856. EOF
  1857. die "Sanity test failed."
  1858. fi
  1859. filter_cflags=echo
  1860. filter_cppflags=echo
  1861. filter_asflags=echo
  1862. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1863. cc_type=llvm_gcc
  1864. cc_version=__VERSION__
  1865. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1866. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1867. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1868. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1869. speed_cflags='-O3'
  1870. size_cflags='-Os'
  1871. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1872. cc_type=gcc
  1873. cc_version=__VERSION__
  1874. gcc_version=$($cc --version | head -n1)
  1875. gcc_basever=$($cc -dumpversion)
  1876. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  1877. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  1878. cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  1879. if ! $cc -dumpversion | grep -q '^2\.'; then
  1880. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1881. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1882. fi
  1883. speed_cflags='-O3'
  1884. size_cflags='-Os'
  1885. elif $cc --version 2>/dev/null | grep -q Intel; then
  1886. cc_type=icc
  1887. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1888. cc_ident=$($cc --version | head -n1)
  1889. icc_version=$($cc -dumpversion)
  1890. CC_DEPFLAGS='-MMD'
  1891. AS_DEPFLAGS='-MMD'
  1892. speed_cflags='-O3'
  1893. size_cflags='-Os'
  1894. noopt_cflags='-O1'
  1895. elif $cc -v 2>&1 | grep -q xlc; then
  1896. cc_type=xlc
  1897. cc_version="AV_STRINGIFY(__IBMC__)"
  1898. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1899. speed_cflags='-O5'
  1900. size_cflags='-O5 -qcompact'
  1901. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1902. cc_type=ccc
  1903. cc_version="AV_STRINGIFY(__DECC_VER)"
  1904. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1905. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1906. debuglevel=3
  1907. add_ldflags -Wl,-z,now # calls to libots crash without this
  1908. speed_cflags='-fast'
  1909. size_cflags='-O1'
  1910. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1911. test -d "$sysroot" || die "No valid sysroot specified."
  1912. cc_type=armcc
  1913. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1914. cc_ident=$($cc --vsn | head -n1)
  1915. armcc_conf="$PWD/armcc.conf"
  1916. $cc --arm_linux_configure \
  1917. --arm_linux_config_file="$armcc_conf" \
  1918. --configure_sysroot="$sysroot" \
  1919. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1920. die "Error creating armcc configuration file."
  1921. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1922. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1923. as_default="${cross_prefix}gcc"
  1924. CC_DEPFLAGS='-MMD'
  1925. AS_DEPFLAGS='-MMD'
  1926. speed_cflags='-O3'
  1927. size_cflags='-Os'
  1928. filter_asflags="filter_out -W${armcc_opt}*"
  1929. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1930. cc_type=tms470
  1931. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1932. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1933. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1934. CC_O='-fr=$(@D)'
  1935. as_default="${cross_prefix}gcc"
  1936. ld_default="${cross_prefix}gcc"
  1937. TMPO=$(basename $TMPC .c).o
  1938. append TMPFILES $TMPO
  1939. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1940. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1941. AS_DEPFLAGS='-MMD'
  1942. speed_cflags='-O3 -mf=5'
  1943. size_cflags='-O3 -mf=2'
  1944. filter_cflags=tms470_flags
  1945. tms470_flags(){
  1946. for flag; do
  1947. case $flag in
  1948. -march=*|-mcpu=*)
  1949. case "${flag#*=}" in
  1950. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1951. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1952. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1953. armv6*|arm11*) echo -mv=6 ;;
  1954. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1955. echo -mv=5e ;;
  1956. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1957. esac
  1958. ;;
  1959. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1960. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1961. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1962. -msoft-float) echo --float_support=vfplib ;;
  1963. -O[0-3]|-mf=*) echo $flag ;;
  1964. -g) echo -g -mn ;;
  1965. -pds=*) echo $flag ;;
  1966. esac
  1967. done
  1968. }
  1969. elif $cc -v 2>&1 | grep -q clang; then
  1970. cc_type=clang
  1971. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1972. cc_version=__clang_version__ || cc_version=__VERSION__
  1973. cc_ident=$($cc --version | head -n1)
  1974. CC_DEPFLAGS='-MMD'
  1975. AS_DEPFLAGS='-MMD'
  1976. speed_cflags='-O3'
  1977. size_cflags='-Os'
  1978. elif $cc -V 2>&1 | grep -q Sun; then
  1979. cc_type=suncc
  1980. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1981. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1982. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1983. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1984. add_ldflags -xc99
  1985. speed_cflags='-O5'
  1986. size_cflags='-O5 -xspace'
  1987. filter_cflags=suncc_flags
  1988. suncc_flags(){
  1989. for flag; do
  1990. case $flag in
  1991. -march=*|-mcpu=*)
  1992. case "${flag#*=}" in
  1993. native) echo -xtarget=native ;;
  1994. v9|niagara) echo -xarch=sparc ;;
  1995. ultrasparc) echo -xarch=sparcvis ;;
  1996. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1997. i586|pentium) echo -xchip=pentium ;;
  1998. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1999. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2000. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2001. pentium4*) echo -xtarget=pentium4 ;;
  2002. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2003. *-sse3) echo -xarch=sse3 ;;
  2004. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2005. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  2006. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2007. k8|opteron|athlon64|athlon-fx)
  2008. echo -xarch=sse2a ;;
  2009. athlon*) echo -xarch=pentium_proa ;;
  2010. esac
  2011. ;;
  2012. -std=c99) echo -xc99 ;;
  2013. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2014. -fPIC) echo -KPIC -xcode=pic32 ;;
  2015. -W*,*) echo $flag ;;
  2016. -f*-*|-W*) ;;
  2017. *) echo $flag ;;
  2018. esac
  2019. done
  2020. }
  2021. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2022. cc_type=pathscale
  2023. cc_version=__PATHSCALE__
  2024. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2025. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2026. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2027. speed_cflags='-O2'
  2028. size_cflags='-Os'
  2029. filter_cflags='filter_out -Wdisabled-optimization'
  2030. elif $cc -v 2>&1 | grep -q Open64; then
  2031. cc_type=open64
  2032. cc_version=__OPEN64__
  2033. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2034. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2035. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2036. speed_cflags='-O2'
  2037. size_cflags='-Os'
  2038. filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2039. fi
  2040. test -n "$cc_type" && enable $cc_type ||
  2041. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2042. : ${as_default:=$cc}
  2043. : ${dep_cc_default:=$cc}
  2044. : ${ld_default:=$cc}
  2045. set_default ar as dep_cc ld
  2046. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  2047. test -n "$CXX_DEPFLAGS" || CXXDEP=$DEPEND_CMD
  2048. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  2049. add_cflags $extra_cflags
  2050. add_cxxflags $extra_cxxflags
  2051. add_asflags $extra_cflags
  2052. if test -n "$sysroot"; then
  2053. case "$cc_type" in
  2054. gcc|llvm_gcc|clang)
  2055. add_cppflags --sysroot="$sysroot"
  2056. add_ldflags --sysroot="$sysroot"
  2057. ;;
  2058. tms470)
  2059. add_cppflags -I"$sysinclude"
  2060. add_ldflags --sysroot="$sysroot"
  2061. ;;
  2062. esac
  2063. fi
  2064. if test "$cpu" = host; then
  2065. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2066. case "$cc_type" in
  2067. gcc|llvm_gcc)
  2068. check_native(){
  2069. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2070. sed -n "/cc1.*$1=/{
  2071. s/.*$1=\\([^ ]*\\).*/\\1/
  2072. p
  2073. q
  2074. }" $TMPE
  2075. }
  2076. cpu=$(check_native -march || check_native -mcpu)
  2077. ;;
  2078. esac
  2079. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2080. fi
  2081. # Deal with common $arch aliases
  2082. case "$arch" in
  2083. arm*)
  2084. arch="arm"
  2085. ;;
  2086. mips|mipsel|IP*)
  2087. arch="mips"
  2088. ;;
  2089. mips64*)
  2090. arch="mips"
  2091. subarch="mips64"
  2092. ;;
  2093. parisc|hppa)
  2094. arch="parisc"
  2095. ;;
  2096. parisc64|hppa64)
  2097. arch="parisc"
  2098. subarch="parisc64"
  2099. ;;
  2100. "Power Macintosh"|ppc|powerpc|ppc64|powerpc64)
  2101. arch="ppc"
  2102. ;;
  2103. s390|s390x)
  2104. arch="s390"
  2105. ;;
  2106. sh4|sh)
  2107. arch="sh4"
  2108. ;;
  2109. sun4u|sparc64)
  2110. arch="sparc"
  2111. subarch="sparc64"
  2112. ;;
  2113. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2114. arch="x86"
  2115. ;;
  2116. esac
  2117. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2118. enable $arch
  2119. # Add processor-specific flags
  2120. if test "$cpu" = generic; then
  2121. : do nothing
  2122. elif enabled ppc; then
  2123. case $(tolower $cpu) in
  2124. 601|ppc601|powerpc601)
  2125. cpuflags="-mcpu=601"
  2126. disable altivec
  2127. ;;
  2128. 603*|ppc603*|powerpc603*)
  2129. cpuflags="-mcpu=603"
  2130. disable altivec
  2131. ;;
  2132. 604*|ppc604*|powerpc604*)
  2133. cpuflags="-mcpu=604"
  2134. disable altivec
  2135. ;;
  2136. g3|75*|ppc75*|powerpc75*)
  2137. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2138. disable altivec
  2139. ;;
  2140. g4|745*|ppc745*|powerpc745*)
  2141. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2142. ;;
  2143. 74*|ppc74*|powerpc74*)
  2144. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2145. ;;
  2146. g5|970|ppc970|powerpc970|power4*)
  2147. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2148. ;;
  2149. cell)
  2150. cpuflags="-mcpu=cell"
  2151. enable ldbrx
  2152. ;;
  2153. e500v2)
  2154. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2155. disable altivec
  2156. ;;
  2157. e500)
  2158. cpuflags="-mcpu=8540 -mhard-float"
  2159. disable altivec
  2160. ;;
  2161. esac
  2162. elif enabled x86; then
  2163. case $cpu in
  2164. i[345]86|pentium)
  2165. cpuflags="-march=$cpu"
  2166. disable mmx
  2167. ;;
  2168. # targets that do NOT support conditional mov (cmov)
  2169. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2170. cpuflags="-march=$cpu"
  2171. disable cmov
  2172. ;;
  2173. # targets that do support conditional mov (cmov)
  2174. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
  2175. cpuflags="-march=$cpu"
  2176. enable cmov
  2177. enable fast_cmov
  2178. ;;
  2179. # targets that do support conditional mov but on which it's slow
  2180. pentium4|pentium4m|prescott|nocona)
  2181. cpuflags="-march=$cpu"
  2182. enable cmov
  2183. disable fast_cmov
  2184. ;;
  2185. esac
  2186. elif enabled sparc; then
  2187. case $cpu in
  2188. niagara)
  2189. cpuflags="-mcpu=$cpu"
  2190. disable vis
  2191. ;;
  2192. sparc64)
  2193. cpuflags="-mcpu=v9"
  2194. ;;
  2195. esac
  2196. elif enabled arm; then
  2197. case $cpu in
  2198. armv*)
  2199. cpuflags="-march=$cpu"
  2200. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2201. ;;
  2202. *)
  2203. cpuflags="-mcpu=$cpu"
  2204. case $cpu in
  2205. cortex-a*) subarch=armv7a ;;
  2206. cortex-r*) subarch=armv7r ;;
  2207. cortex-m*) enable thumb; subarch=armv7m ;;
  2208. arm11*) subarch=armv6 ;;
  2209. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2210. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2211. esac
  2212. ;;
  2213. esac
  2214. elif enabled alpha; then
  2215. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2216. elif enabled bfin; then
  2217. cpuflags="-mcpu=$cpu"
  2218. elif enabled mips; then
  2219. cpuflags="-march=$cpu"
  2220. elif enabled avr32; then
  2221. case $cpu in
  2222. ap7[02]0[0-2])
  2223. subarch="avr32_ap"
  2224. cpuflags="-mpart=$cpu"
  2225. ;;
  2226. ap)
  2227. subarch="avr32_ap"
  2228. cpuflags="-march=$cpu"
  2229. ;;
  2230. uc3[ab]*)
  2231. subarch="avr32_uc"
  2232. cpuflags="-mcpu=$cpu"
  2233. ;;
  2234. uc)
  2235. subarch="avr32_uc"
  2236. cpuflags="-march=$cpu"
  2237. ;;
  2238. esac
  2239. fi
  2240. add_cflags $cpuflags
  2241. add_asflags $cpuflags
  2242. # compiler sanity check
  2243. check_exec <<EOF
  2244. int main(void){ return 0; }
  2245. EOF
  2246. if test "$?" != 0; then
  2247. echo "$cc is unable to create an executable file."
  2248. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2249. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2250. echo "Only do this if you know what cross compiling means."
  2251. fi
  2252. die "C compiler test failed."
  2253. fi
  2254. add_cppflags -D_ISOC99_SOURCE
  2255. add_cxxflags -D__STDC_CONSTANT_MACROS
  2256. check_cflags -std=c99
  2257. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2258. #include <stdlib.h>
  2259. EOF
  2260. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2261. #include <stdlib.h>
  2262. EOF
  2263. check_host_cflags -std=c99
  2264. check_host_cflags -Wall
  2265. case "$arch" in
  2266. alpha|ia64|mips|parisc|sparc)
  2267. spic=$shared
  2268. ;;
  2269. x86)
  2270. subarch="x86_32"
  2271. check_cc <<EOF && subarch="x86_64"
  2272. int test[(int)sizeof(char*) - 7];
  2273. EOF
  2274. if test "$subarch" = "x86_64"; then
  2275. spic=$shared
  2276. fi
  2277. ;;
  2278. ppc)
  2279. check_cc <<EOF && subarch="ppc64"
  2280. int test[(int)sizeof(char*) - 7];
  2281. EOF
  2282. ;;
  2283. esac
  2284. enable $subarch
  2285. enabled spic && enable pic
  2286. # OS specific
  2287. case $target_os in
  2288. haiku)
  2289. prefix_default="/boot/common"
  2290. network_extralibs="-lnetwork"
  2291. host_libs=
  2292. ;;
  2293. sunos)
  2294. FFSERVERLDFLAGS=""
  2295. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2296. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2297. network_extralibs="-lsocket -lnsl"
  2298. add_cppflags -D__EXTENSIONS__
  2299. # When using suncc to build, the Solaris linker will mark
  2300. # an executable with each instruction set encountered by
  2301. # the Solaris assembler. As our libraries contain their own
  2302. # guards for processor-specific code, instead suppress
  2303. # generation of the HWCAPS ELF section on Solaris x86 only.
  2304. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2305. nm_opts='-P -g'
  2306. ;;
  2307. netbsd)
  2308. disable symver
  2309. oss_indev_extralibs="-lossaudio"
  2310. oss_outdev_extralibs="-lossaudio"
  2311. ;;
  2312. openbsd)
  2313. enable malloc_aligned
  2314. # On OpenBSD 4.5. the compiler does not use PIC unless
  2315. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2316. # however the generated executable will not do anything
  2317. # (simply quits with exit-code 1, no crash, no output).
  2318. # Thus explicitly enable PIC here.
  2319. enable pic
  2320. disable symver
  2321. SHFLAGS='-shared'
  2322. oss_indev_extralibs="-lossaudio"
  2323. oss_outdev_extralibs="-lossaudio"
  2324. ;;
  2325. dragonfly)
  2326. enable malloc_aligned
  2327. disable symver
  2328. ;;
  2329. freebsd)
  2330. enable malloc_aligned
  2331. ;;
  2332. bsd/os)
  2333. add_extralibs -lpoll -lgnugetopt
  2334. strip="strip -d"
  2335. ;;
  2336. darwin)
  2337. enable malloc_aligned
  2338. gas="gas-preprocessor.pl $cc"
  2339. enabled ppc && add_asflags -force_cpusubtype_ALL
  2340. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2341. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2342. strip="${strip} -x"
  2343. add_ldflags -Wl,-dynamic,-search_paths_first
  2344. SLIBSUF=".dylib"
  2345. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2346. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2347. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2348. objformat="macho"
  2349. enabled x86_64 && objformat="macho64"
  2350. enabled_any pic shared ||
  2351. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2352. ;;
  2353. mingw32*)
  2354. if test $target_os = "mingw32ce"; then
  2355. disable network
  2356. else
  2357. target_os=mingw32
  2358. enable_weak w32threads
  2359. fi
  2360. LIBTARGET=i386
  2361. if enabled x86_64; then
  2362. enable malloc_aligned
  2363. LIBTARGET=x64
  2364. elif enabled arm; then
  2365. LIBTARGET=arm-wince
  2366. fi
  2367. shlibdir_default="$bindir_default"
  2368. SLIBPREF=""
  2369. SLIBSUF=".dll"
  2370. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2371. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2372. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2373. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2374. SLIB_INSTALL_LINKS=
  2375. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2376. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2377. 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'
  2378. objformat="win32"
  2379. enable dos_paths
  2380. check_cflags -fno-common
  2381. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2382. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2383. die "ERROR: MinGW runtime version must be >= 3.15."
  2384. add_cppflags -U__STRICT_ANSI__
  2385. ;;
  2386. cygwin*)
  2387. target_os=cygwin
  2388. shlibdir_default="$bindir_default"
  2389. SLIBPREF="cyg"
  2390. SLIBSUF=".dll"
  2391. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2392. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2393. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2394. objformat="win32"
  2395. enable dos_paths
  2396. check_cflags -fno-common
  2397. add_cppflags -U__STRICT_ANSI__
  2398. ;;
  2399. *-dos|freedos|opendos)
  2400. network_extralibs="-lsocket"
  2401. objformat="coff"
  2402. enable dos_paths
  2403. add_cppflags -U__STRICT_ANSI__
  2404. ;;
  2405. linux)
  2406. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2407. enable dv1394
  2408. ;;
  2409. irix*)
  2410. target_os=irix
  2411. ranlib="echo ignoring ranlib"
  2412. ;;
  2413. os/2*)
  2414. strip="lxlite -CS"
  2415. ln_s="cp -f"
  2416. objformat="aout"
  2417. add_cppflags -D_GNU_SOURCE
  2418. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2419. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2420. FFSERVERLDFLAGS=""
  2421. LIBSUF="_s.a"
  2422. SLIBPREF=""
  2423. SLIBSUF=".dll"
  2424. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2425. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2426. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2427. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2428. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2429. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2430. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2431. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2432. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2433. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2434. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2435. enable dos_paths
  2436. enable_weak os2threads
  2437. ;;
  2438. gnu/kfreebsd)
  2439. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2440. ;;
  2441. gnu)
  2442. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2443. ;;
  2444. qnx)
  2445. add_cppflags -D_QNX_SOURCE
  2446. network_extralibs="-lsocket"
  2447. ;;
  2448. symbian)
  2449. SLIBSUF=".dll"
  2450. enable dos_paths
  2451. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2452. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2453. add_ldflags -Wl,--target1-abs,--no-undefined \
  2454. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2455. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2456. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2457. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2458. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2459. ;;
  2460. none)
  2461. ;;
  2462. *)
  2463. die "Unknown OS '$target_os'."
  2464. ;;
  2465. esac
  2466. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
  2467. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2468. set_default $PATHS_LIST
  2469. # we need to build at least one lib type
  2470. if ! enabled_any static shared; then
  2471. cat <<EOF
  2472. At least one library type must be built.
  2473. Specify --enable-static to build the static libraries or --enable-shared to
  2474. build the shared libraries as well. To only build the shared libraries specify
  2475. --disable-static in addition to --enable-shared.
  2476. EOF
  2477. exit 1;
  2478. fi
  2479. die_license_disabled() {
  2480. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2481. }
  2482. die_license_disabled gpl libcdio
  2483. die_license_disabled gpl libx264
  2484. die_license_disabled gpl libxavs
  2485. die_license_disabled gpl libxvid
  2486. die_license_disabled gpl x11grab
  2487. die_license_disabled nonfree libaacplus
  2488. die_license_disabled nonfree libfaac
  2489. die_license_disabled nonfree openssl
  2490. die_license_disabled version3 libopencore_amrnb
  2491. die_license_disabled version3 libopencore_amrwb
  2492. die_license_disabled version3 libvo_aacenc
  2493. die_license_disabled version3 libvo_amrwbenc
  2494. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2495. disabled optimizations || check_cflags -fomit-frame-pointer
  2496. enable_pic() {
  2497. enable pic
  2498. add_cppflags -DPIC
  2499. add_cflags -fPIC
  2500. add_asflags -fPIC
  2501. }
  2502. enabled pic && enable_pic
  2503. check_cc <<EOF || die "Symbol mangling check failed."
  2504. int ff_extern;
  2505. EOF
  2506. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2507. extern_prefix=${sym%%ff_extern*}
  2508. check_cc <<EOF && enable inline_asm
  2509. void foo(void) { __asm__ volatile ("" ::); }
  2510. EOF
  2511. _restrict=
  2512. for restrict_keyword in restrict __restrict__ __restrict; do
  2513. check_cc <<EOF && _restrict=$restrict_keyword && break
  2514. void foo(char * $restrict_keyword p);
  2515. EOF
  2516. done
  2517. check_cc <<EOF && enable attribute_packed
  2518. struct { int x; } __attribute__((packed)) x;
  2519. EOF
  2520. check_cc <<EOF && enable attribute_may_alias
  2521. union { int x; } __attribute__((may_alias)) x;
  2522. EOF
  2523. check_cc <<EOF || die "endian test failed"
  2524. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2525. EOF
  2526. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2527. if enabled alpha; then
  2528. check_cflags -mieee
  2529. elif enabled arm; then
  2530. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2531. nogas=die
  2532. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2533. enable vfp_args
  2534. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2535. case "${cross_prefix:-$cc}" in
  2536. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2537. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2538. __asm__ (".eabi_attribute 28, 1");
  2539. int main(void) { return 0; }
  2540. EOF
  2541. esac
  2542. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2543. fi
  2544. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2545. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2546. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2547. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2548. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2549. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2550. enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2551. check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2552. enabled_all armv6t2 shared !pic && enable_pic
  2553. elif enabled mips; then
  2554. check_asm loongson '"dmult.g $1, $2, $3"'
  2555. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2556. elif enabled ppc; then
  2557. enable local_aligned_8 local_aligned_16
  2558. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2559. check_asm ibm_asm '"add 0, 0, 0"'
  2560. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2561. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2562. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2563. if enabled altivec; then
  2564. nogas=warn
  2565. check_cflags -maltivec -mabi=altivec &&
  2566. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2567. check_cflags -faltivec
  2568. # check if our compiler supports Motorola AltiVec C API
  2569. check_cc <<EOF || disable altivec
  2570. $inc_altivec_h
  2571. int main(void) {
  2572. vector signed int v1, v2, v3;
  2573. v1 = vec_add(v2,v3);
  2574. return 0;
  2575. }
  2576. EOF
  2577. # check if our compiler supports braces for vector declarations
  2578. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2579. $inc_altivec_h
  2580. int main (void) { (vector int) {1}; return 0; }
  2581. EOF
  2582. fi
  2583. elif enabled sparc; then
  2584. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2585. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2586. elif enabled x86; then
  2587. enable local_aligned_8 local_aligned_16
  2588. # check whether EBP is available on x86
  2589. # As 'i' is stored on the stack, this program will crash
  2590. # if the base pointer is used to access it because the
  2591. # base pointer is cleared in the inline assembly code.
  2592. check_exec_crash <<EOF && enable ebp_available
  2593. volatile int i=0;
  2594. __asm__ volatile (
  2595. "xorl %%ebp, %%ebp"
  2596. ::: "%ebp");
  2597. return i;
  2598. EOF
  2599. # check whether EBX is available on x86
  2600. check_asm ebx_available '""::"b"(0)' &&
  2601. check_asm ebx_available '"":::"%ebx"'
  2602. # check whether xmm clobbers are supported
  2603. check_asm xmm_clobbers '"":::"%xmm0"'
  2604. # check whether binutils is new enough to compile SSSE3/MMX2
  2605. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2606. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2607. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2608. if ! disabled_any asm mmx yasm; then
  2609. if check_cmd $yasmexe --version; then
  2610. enabled x86_64 && yasm_extra="-m amd64"
  2611. yasm_debug="-g dwarf2"
  2612. elif check_cmd nasm -v; then
  2613. yasmexe=nasm
  2614. yasm_debug="-g -F dwarf"
  2615. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2616. fi
  2617. YASMFLAGS="-f $objformat $yasm_extra"
  2618. enabled pic && append YASMFLAGS "-DPIC"
  2619. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2620. case "$objformat" in
  2621. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2622. esac
  2623. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2624. die "yasm not found, use --disable-yasm for a crippled build"
  2625. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
  2626. fi
  2627. case "$cpu" in
  2628. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2629. disable fast_clz
  2630. ;;
  2631. esac
  2632. fi
  2633. if enabled asm; then
  2634. as=${gas:=$as}
  2635. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2636. $nogas "GNU assembler not found, install gas-preprocessor"
  2637. fi
  2638. check_ldflags -Wl,--as-needed
  2639. if check_func dlopen; then
  2640. ldl=
  2641. elif check_func dlopen -ldl; then
  2642. ldl=-ldl
  2643. fi
  2644. if enabled network; then
  2645. check_type "sys/types.h sys/socket.h" socklen_t
  2646. check_type netdb.h "struct addrinfo"
  2647. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2648. check_type netinet/in.h "struct sockaddr_in6"
  2649. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2650. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2651. # Prefer arpa/inet.h over winsock2
  2652. if check_header arpa/inet.h ; then
  2653. check_func closesocket
  2654. elif check_header winsock2.h ; then
  2655. check_func_headers winsock2.h closesocket -lws2 && \
  2656. network_extralibs="-lws2" || \
  2657. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2658. network_extralibs="-lws2_32"; }
  2659. check_type ws2tcpip.h socklen_t
  2660. check_type ws2tcpip.h "struct addrinfo"
  2661. check_type ws2tcpip.h "struct ipv6_mreq"
  2662. check_type ws2tcpip.h "struct sockaddr_in6"
  2663. check_type ws2tcpip.h "struct sockaddr_storage"
  2664. check_struct winsock2.h "struct sockaddr" sa_len
  2665. else
  2666. disable network
  2667. fi
  2668. fi
  2669. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2670. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2671. check_func fcntl
  2672. check_func fork
  2673. check_func getaddrinfo $network_extralibs
  2674. check_func gethrtime
  2675. check_func getrusage
  2676. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2677. check_func inet_aton $network_extralibs
  2678. check_func isatty
  2679. check_func localtime_r
  2680. check_func ${malloc_prefix}memalign && enable memalign
  2681. check_func mkstemp
  2682. check_func mmap
  2683. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2684. check_func setrlimit
  2685. check_func strerror_r
  2686. check_func strptime
  2687. check_func_headers conio.h kbhit
  2688. check_func_headers windows.h PeekNamedPipe
  2689. check_func_headers io.h setmode
  2690. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2691. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2692. check_func_headers windows.h GetProcessTimes
  2693. check_func_headers windows.h MapViewOfFile
  2694. check_func_headers windows.h VirtualAlloc
  2695. check_header dlfcn.h
  2696. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  2697. check_header libcrystalhd/libcrystalhd_if.h
  2698. check_header malloc.h
  2699. check_header poll.h
  2700. check_header sys/mman.h
  2701. check_header sys/resource.h
  2702. check_header sys/select.h
  2703. check_header termios.h
  2704. check_header vdpau/vdpau.h
  2705. check_header vdpau/vdpau_x11.h
  2706. check_header X11/extensions/XvMClib.h
  2707. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2708. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2709. # check for VDA header
  2710. if ! disabled vda; then
  2711. if check_header VideoDecodeAcceleration/VDADecoder.h; then
  2712. enable vda
  2713. add_ldflags -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
  2714. fi
  2715. fi
  2716. # check for some common methods of building with pthread support
  2717. # do this before the optional library checks as some of them require pthreads
  2718. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  2719. enable pthreads
  2720. if check_func pthread_create; then
  2721. :
  2722. elif check_func pthread_create -pthread; then
  2723. add_cflags -pthread
  2724. add_extralibs -pthread
  2725. elif check_func pthread_create -pthreads; then
  2726. add_cflags -pthreads
  2727. add_extralibs -pthreads
  2728. elif check_func pthread_create -lpthreadGC2; then
  2729. add_extralibs -lpthreadGC2
  2730. elif ! check_lib pthread.h pthread_create -lpthread; then
  2731. disable pthreads
  2732. fi
  2733. fi
  2734. for thread in $THREADS_LIST; do
  2735. if enabled $thread; then
  2736. test -n "$thread_type" &&
  2737. die "ERROR: Only one thread type must be selected." ||
  2738. thread_type="$thread"
  2739. fi
  2740. done
  2741. check_lib math.h sin -lm && LIBM="-lm"
  2742. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  2743. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  2744. check_mathfunc cbrtf
  2745. check_mathfunc exp2
  2746. check_mathfunc exp2f
  2747. check_mathfunc llrint
  2748. check_mathfunc llrintf
  2749. check_mathfunc log2
  2750. check_mathfunc log2f
  2751. check_mathfunc lrint
  2752. check_mathfunc lrintf
  2753. check_mathfunc round
  2754. check_mathfunc roundf
  2755. check_mathfunc trunc
  2756. check_mathfunc truncf
  2757. # these are off by default, so fail if requested and not available
  2758. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2759. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0
  2760. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2761. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  2762. enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
  2763. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  2764. enabled libdirac && require_pkg_config dirac \
  2765. "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
  2766. "dirac_decoder_init dirac_encoder_init"
  2767. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2768. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  2769. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2770. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  2771. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2772. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2773. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2774. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2775. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  2776. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2777. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  2778. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2779. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2780. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2781. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  2782. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  2783. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder
  2784. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2785. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  2786. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  2787. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2788. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  2789. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2790. enabled libvpx && {
  2791. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2792. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2793. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  2794. die "ERROR: libvpx encoder version must be >=0.9.6"; } }
  2795. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2796. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  2797. die "ERROR: libx264 version must be >= 0.118."; }
  2798. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2799. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2800. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  2801. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  2802. die "ERROR: openal not found"; } &&
  2803. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  2804. die "ERROR: openal version must be 1.1 or compatible"; }
  2805. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2806. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  2807. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  2808. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  2809. die "ERROR: openssl not found"; }
  2810. SDL_CONFIG="${cross_prefix}sdl-config"
  2811. if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
  2812. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2813. enable sdl &&
  2814. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2815. else
  2816. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2817. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2818. sdl_libs=$("${SDL_CONFIG}" --libs)
  2819. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  2820. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2821. enable sdl &&
  2822. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2823. fi
  2824. fi
  2825. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  2826. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2827. check_header linux/fb.h
  2828. check_header linux/videodev.h
  2829. check_header linux/videodev2.h
  2830. check_header sys/videoio.h
  2831. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2832. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2833. # w32api 3.12 had it defined wrong
  2834. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2835. check_type "dshow.h" IBaseFilter
  2836. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2837. { check_header dev/bktr/ioctl_meteor.h &&
  2838. check_header dev/bktr/ioctl_bt848.h; } ||
  2839. { check_header machine/ioctl_meteor.h &&
  2840. check_header machine/ioctl_bt848.h; } ||
  2841. { check_header dev/video/meteor/ioctl_meteor.h &&
  2842. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2843. check_header dev/ic/bt8xx.h
  2844. check_header sndio.h
  2845. if check_struct sys/soundcard.h audio_buf_info bytes; then
  2846. enable_safe sys/soundcard.h
  2847. else
  2848. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  2849. #include <sys/soundcard.h>
  2850. audio_buf_info abc;
  2851. EOF
  2852. fi
  2853. check_header soundcard.h
  2854. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2855. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait
  2856. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  2857. enabled libcdio &&
  2858. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  2859. enabled x11grab &&
  2860. check_header X11/Xlib.h &&
  2861. check_header X11/extensions/XShm.h &&
  2862. check_header X11/extensions/Xfixes.h &&
  2863. check_func XOpenDisplay -lX11 &&
  2864. check_func XShmCreateImage -lX11 -lXext &&
  2865. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2866. if ! disabled vaapi; then
  2867. check_lib va/va.h vaInitialize -lva && {
  2868. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  2869. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  2870. } || disable vaapi
  2871. fi
  2872. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2873. check_cpp_condition \
  2874. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2875. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2876. disable vdpau; }
  2877. fi
  2878. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2879. # add some useful compiler flags if supported
  2880. check_cflags -Wdeclaration-after-statement
  2881. check_cflags -Wall
  2882. check_cflags -Wno-parentheses
  2883. check_cflags -Wno-switch
  2884. check_cflags -Wno-format-zero-length
  2885. check_cflags -Wdisabled-optimization
  2886. check_cflags -Wpointer-arith
  2887. check_cflags -Wredundant-decls
  2888. check_cflags -Wno-pointer-sign
  2889. check_cflags -Wcast-qual
  2890. check_cflags -Wwrite-strings
  2891. check_cflags -Wtype-limits
  2892. check_cflags -Wundef
  2893. check_cflags -Wmissing-prototypes
  2894. check_cflags -Wno-pointer-to-int-cast
  2895. check_cflags -Wstrict-prototypes
  2896. enabled extra_warnings && check_cflags -Winline
  2897. # add some linker flags
  2898. check_ldflags -Wl,--warn-common
  2899. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
  2900. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2901. echo "X{};" > $TMPV
  2902. if test_ldflags -Wl,--version-script,$TMPV; then
  2903. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2904. check_cc <<EOF && enable symver_asm_label
  2905. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2906. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2907. EOF
  2908. check_cc <<EOF && enable symver_gnu_asm
  2909. __asm__(".symver ff_foo,av_foo@VERSION");
  2910. void ff_foo(void) {}
  2911. EOF
  2912. fi
  2913. if [ -n "$optflags" ]; then
  2914. add_cflags $optflags
  2915. elif enabled small; then
  2916. add_cflags $size_cflags
  2917. elif enabled optimizations; then
  2918. add_cflags $speed_cflags
  2919. else
  2920. add_cflags $noopt_cflags
  2921. fi
  2922. check_cflags -fno-math-errno
  2923. check_cflags -fno-signed-zeros
  2924. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  2925. int x;
  2926. EOF
  2927. if enabled icc; then
  2928. # Just warnings, no remarks
  2929. check_cflags -w1
  2930. # -wd: Disable following warnings
  2931. # 144, 167, 556: -Wno-pointer-sign
  2932. # 1292: attribute "foo" ignored
  2933. # 10006: ignoring unknown option -fno-signed-zeros
  2934. # 10148: ignoring unknown option -Wno-parentheses
  2935. # 10156: ignoring option '-W'; no argument required
  2936. check_cflags -wd144,167,556,1292,10006,10148,10156
  2937. # 11030: Warning unknown option --as-needed
  2938. # 10156: ignoring option '-export'; no argument required
  2939. check_ldflags -wd10156,11030
  2940. # Allow to compile with optimizations
  2941. check_ldflags -march=$cpu
  2942. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2943. enable ebp_available
  2944. if enabled x86_32; then
  2945. test ${icc_version%%.*} -ge 11 && \
  2946. check_cflags -falign-stack=maintain-16-byte || \
  2947. disable aligned_stack
  2948. fi
  2949. elif enabled ccc; then
  2950. # disable some annoying warnings
  2951. add_cflags -msg_disable cvtu32to64
  2952. add_cflags -msg_disable embedcomment
  2953. add_cflags -msg_disable needconstext
  2954. add_cflags -msg_disable nomainieee
  2955. add_cflags -msg_disable ptrmismatch1
  2956. add_cflags -msg_disable unreachcode
  2957. elif enabled gcc; then
  2958. check_cflags -fno-tree-vectorize
  2959. check_cflags -Werror=implicit-function-declaration
  2960. check_cflags -Werror=missing-prototypes
  2961. elif enabled llvm_gcc; then
  2962. check_cflags -mllvm -stack-alignment=16
  2963. elif enabled clang; then
  2964. check_cflags -mllvm -stack-alignment=16
  2965. check_cflags -Qunused-arguments
  2966. elif enabled armcc; then
  2967. # 2523: use of inline assembler is deprecated
  2968. add_cflags -W${armcc_opt},--diag_suppress=2523
  2969. add_cflags -W${armcc_opt},--diag_suppress=1207
  2970. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2971. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2972. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  2973. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  2974. elif enabled tms470; then
  2975. add_cflags -pds=824 -pds=837
  2976. elif enabled pathscale; then
  2977. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2978. fi
  2979. enabled_any $THREADS_LIST && enable threads
  2980. check_deps $CONFIG_LIST \
  2981. $CONFIG_EXTRA \
  2982. $HAVE_LIST \
  2983. $DECODER_LIST \
  2984. $ENCODER_LIST \
  2985. $HWACCEL_LIST \
  2986. $PARSER_LIST \
  2987. $BSF_LIST \
  2988. $DEMUXER_LIST \
  2989. $MUXER_LIST \
  2990. $FILTER_LIST \
  2991. $INDEV_LIST \
  2992. $OUTDEV_LIST \
  2993. $PROTOCOL_LIST \
  2994. $ACODEC_TESTS \
  2995. $VCODEC_TESTS \
  2996. $LAVF_TESTS \
  2997. $LAVFI_TESTS \
  2998. $SEEK_TESTS \
  2999. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3000. if test $target_os = "haiku"; then
  3001. disable memalign
  3002. disable posix_memalign
  3003. fi
  3004. ! enabled_any memalign posix_memalign malloc_aligned &&
  3005. enabled_any $need_memalign && enable memalign_hack
  3006. echo "install prefix $prefix"
  3007. echo "source path $source_path"
  3008. echo "C compiler $cc"
  3009. echo "ARCH $arch ($cpu)"
  3010. if test "$build_suffix" != ""; then
  3011. echo "build suffix $build_suffix"
  3012. fi
  3013. if test "$progs_suffix" != ""; then
  3014. echo "progs suffix $progs_suffix"
  3015. fi
  3016. if test "$extra_version" != ""; then
  3017. echo "version string suffix $extra_version"
  3018. fi
  3019. echo "big-endian ${bigendian-no}"
  3020. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3021. if enabled x86; then
  3022. echo "${yasmexe} ${yasm-no}"
  3023. echo "MMX enabled ${mmx-no}"
  3024. echo "MMX2 enabled ${mmx2-no}"
  3025. echo "3DNow! enabled ${amd3dnow-no}"
  3026. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3027. echo "SSE enabled ${sse-no}"
  3028. echo "SSSE3 enabled ${ssse3-no}"
  3029. echo "AVX enabled ${avx-no}"
  3030. echo "CMOV enabled ${cmov-no}"
  3031. echo "CMOV is fast ${fast_cmov-no}"
  3032. echo "EBX available ${ebx_available-no}"
  3033. echo "EBP available ${ebp_available-no}"
  3034. fi
  3035. if enabled arm; then
  3036. echo "ARMv5TE enabled ${armv5te-no}"
  3037. echo "ARMv6 enabled ${armv6-no}"
  3038. echo "ARMv6T2 enabled ${armv6t2-no}"
  3039. echo "ARM VFP enabled ${armvfp-no}"
  3040. echo "IWMMXT enabled ${iwmmxt-no}"
  3041. echo "NEON enabled ${neon-no}"
  3042. fi
  3043. if enabled mips; then
  3044. echo "MMI enabled ${mmi-no}"
  3045. fi
  3046. if enabled ppc; then
  3047. echo "AltiVec enabled ${altivec-no}"
  3048. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3049. echo "dcbzl available ${dcbzl-no}"
  3050. fi
  3051. if enabled sparc; then
  3052. echo "VIS enabled ${vis-no}"
  3053. fi
  3054. echo "debug symbols ${debug-no}"
  3055. echo "strip symbols ${stripping-no}"
  3056. echo "optimize for size ${small-no}"
  3057. echo "optimizations ${optimizations-no}"
  3058. echo "static ${static-no}"
  3059. echo "shared ${shared-no}"
  3060. echo "postprocessing support ${postproc-no}"
  3061. echo "new filter support ${avfilter-no}"
  3062. echo "network support ${network-no}"
  3063. echo "threading support ${thread_type-no}"
  3064. echo "SDL support ${sdl-no}"
  3065. echo "Sun medialib support ${mlib-no}"
  3066. echo "libdxva2 enabled ${dxva2-no}"
  3067. echo "libva enabled ${vaapi-no}"
  3068. echo "libvdpau enabled ${vdpau-no}"
  3069. echo "AVISynth enabled ${avisynth-no}"
  3070. echo "libcelt enabled ${libcelt-no}"
  3071. echo "frei0r enabled ${frei0r-no}"
  3072. echo "gnutls enabled ${gnutls-no}"
  3073. echo "libcdio support ${libcdio-no}"
  3074. echo "libdc1394 support ${libdc1394-no}"
  3075. echo "libdirac enabled ${libdirac-no}"
  3076. echo "libfaac enabled ${libfaac-no}"
  3077. echo "libaacplus enabled ${libaacplus-no}"
  3078. echo "libgsm enabled ${libgsm-no}"
  3079. echo "libmodplug enabled ${libmodplug-no}"
  3080. echo "libmp3lame enabled ${libmp3lame-no}"
  3081. echo "libnut enabled ${libnut-no}"
  3082. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3083. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3084. echo "libopencv support ${libopencv-no}"
  3085. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3086. echo "libpulse enabled ${libpulse-no}"
  3087. echo "librtmp enabled ${librtmp-no}"
  3088. echo "libschroedinger enabled ${libschroedinger-no}"
  3089. echo "libspeex enabled ${libspeex-no}"
  3090. echo "libstagefright-h264 enabled ${libstagefright_h264-no}"
  3091. echo "libtheora enabled ${libtheora-no}"
  3092. echo "libutvideo enabled ${libutvideo-no}"
  3093. echo "libv4l2 enabled ${libv4l2-no}"
  3094. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3095. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3096. echo "libvorbis enabled ${libvorbis-no}"
  3097. echo "libvpx enabled ${libvpx-no}"
  3098. echo "libx264 enabled ${libx264-no}"
  3099. echo "libxavs enabled ${libxavs-no}"
  3100. echo "libxvid enabled ${libxvid-no}"
  3101. echo "openal enabled ${openal-no}"
  3102. echo "openssl enabled ${openssl-no}"
  3103. echo "zlib enabled ${zlib-no}"
  3104. echo "bzlib enabled ${bzlib-no}"
  3105. echo
  3106. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3107. echo "Enabled ${type}s:"
  3108. eval list=\$$(toupper $type)_LIST
  3109. print_enabled '_*' $list | sort | pr -r -3 -t
  3110. echo
  3111. done
  3112. license="LGPL version 2.1 or later"
  3113. if enabled nonfree; then
  3114. license="nonfree and unredistributable"
  3115. elif enabled gplv3; then
  3116. license="GPL version 3 or later"
  3117. elif enabled lgplv3; then
  3118. license="LGPL version 3 or later"
  3119. elif enabled gpl; then
  3120. license="GPL version 2 or later"
  3121. fi
  3122. echo "License: $license"
  3123. echo "Creating config.mak and config.h..."
  3124. test -e Makefile || $ln_s "$source_path/Makefile" .
  3125. enabled stripping || strip="echo skipping strip"
  3126. config_files="$TMPH config.mak"
  3127. cat > config.mak <<EOF
  3128. # Automatically generated by configure - do not modify!
  3129. ifndef FFMPEG_CONFIG_MAK
  3130. FFMPEG_CONFIG_MAK=1
  3131. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  3132. prefix=$prefix
  3133. LIBDIR=\$(DESTDIR)$libdir
  3134. SHLIBDIR=\$(DESTDIR)$shlibdir
  3135. INCDIR=\$(DESTDIR)$incdir
  3136. BINDIR=\$(DESTDIR)$bindir
  3137. DATADIR=\$(DESTDIR)$datadir
  3138. MANDIR=\$(DESTDIR)$mandir
  3139. SRC_PATH=$source_path
  3140. ifndef MAIN_MAKEFILE
  3141. SRC_PATH:=\$(SRC_PATH:.%=..%)
  3142. endif
  3143. CC_IDENT=$cc_ident
  3144. ARCH=$arch
  3145. CC=$cc
  3146. CXX=$cxx
  3147. AS=$as
  3148. LD=$ld
  3149. DEPCC=$dep_cc
  3150. YASM=$yasmexe
  3151. YASMDEP=$yasmexe
  3152. AR=$ar
  3153. RANLIB=$ranlib
  3154. CP=cp -p
  3155. LN_S=$ln_s
  3156. STRIP=$strip
  3157. CPPFLAGS=$CPPFLAGS
  3158. CFLAGS=$CFLAGS
  3159. CXXFLAGS=$CXXFLAGS
  3160. ASFLAGS=$ASFLAGS
  3161. AS_O=$CC_O
  3162. CC_O=$CC_O
  3163. CXX_O=$CXX_O
  3164. LDFLAGS=$LDFLAGS
  3165. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  3166. SHFLAGS=$SHFLAGS
  3167. YASMFLAGS=$YASMFLAGS
  3168. BUILDSUF=$build_suffix
  3169. PROGSSUF=$progs_suffix
  3170. FULLNAME=$FULLNAME
  3171. LIBPREF=$LIBPREF
  3172. LIBSUF=$LIBSUF
  3173. LIBNAME=$LIBNAME
  3174. SLIBPREF=$SLIBPREF
  3175. SLIBSUF=$SLIBSUF
  3176. EXESUF=$EXESUF
  3177. EXTRA_VERSION=$extra_version
  3178. DEPFLAGS=$DEPFLAGS
  3179. CCDEP=$CCDEP
  3180. CXXDEP=$CXXDEP
  3181. ASDEP=$ASDEP
  3182. CC_DEPFLAGS=$CC_DEPFLAGS
  3183. AS_DEPFLAGS=$AS_DEPFLAGS
  3184. HOSTCC=$host_cc
  3185. HOSTCFLAGS=$host_cflags
  3186. HOSTEXESUF=$HOSTEXESUF
  3187. HOSTLDFLAGS=$host_ldflags
  3188. HOSTLIBS=$host_libs
  3189. TARGET_EXEC=$target_exec
  3190. TARGET_PATH=$target_path
  3191. SDL_LIBS=$sdl_libs
  3192. SDL_CFLAGS=$sdl_cflags
  3193. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3194. EXTRALIBS=$extralibs
  3195. INSTALL=$install
  3196. LIBTARGET=${LIBTARGET}
  3197. SLIBNAME=${SLIBNAME}
  3198. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3199. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3200. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3201. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3202. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3203. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3204. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3205. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3206. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  3207. NOREDZONE_FLAGS=$noredzone_flags
  3208. EOF
  3209. get_version(){
  3210. name=$1
  3211. file=$source_path/$2
  3212. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3213. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3214. lcname=$(tolower $name)
  3215. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3216. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3217. }
  3218. get_version LIBSWSCALE libswscale/swscale.h
  3219. get_version LIBSWRESAMPLE libswresample/swresample.h
  3220. get_version LIBPOSTPROC libpostproc/postprocess.h
  3221. get_version LIBAVCODEC libavcodec/version.h
  3222. get_version LIBAVDEVICE libavdevice/avdevice.h
  3223. get_version LIBAVFORMAT libavformat/version.h
  3224. get_version LIBAVUTIL libavutil/avutil.h
  3225. get_version LIBAVFILTER libavfilter/avfilter.h
  3226. cat > $TMPH <<EOF
  3227. /* Automatically generated by configure - do not modify! */
  3228. #ifndef FFMPEG_CONFIG_H
  3229. #define FFMPEG_CONFIG_H
  3230. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  3231. #define FFMPEG_LICENSE "$(c_escape $license)"
  3232. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  3233. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3234. #define CC_TYPE "$cc_type"
  3235. #define CC_VERSION $cc_version
  3236. #define restrict $_restrict
  3237. #define EXTERN_PREFIX "${extern_prefix}"
  3238. #define EXTERN_ASM ${extern_prefix}
  3239. #define SLIBSUF "$SLIBSUF"
  3240. EOF
  3241. test -n "$malloc_prefix" &&
  3242. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3243. if enabled small || disabled optimizations; then
  3244. echo "#undef av_always_inline" >> $TMPH
  3245. if enabled small; then
  3246. echo "#define av_always_inline inline" >> $TMPH
  3247. else
  3248. echo "#define av_always_inline av_unused" >> $TMPH
  3249. fi
  3250. fi
  3251. if enabled yasm; then
  3252. append config_files $TMPASM
  3253. printf '' >$TMPASM
  3254. fi
  3255. print_config ARCH_ "$config_files" $ARCH_LIST
  3256. print_config HAVE_ "$config_files" $HAVE_LIST
  3257. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3258. $CONFIG_EXTRA \
  3259. $DECODER_LIST \
  3260. $ENCODER_LIST \
  3261. $HWACCEL_LIST \
  3262. $PARSER_LIST \
  3263. $BSF_LIST \
  3264. $DEMUXER_LIST \
  3265. $MUXER_LIST \
  3266. $FILTER_LIST \
  3267. $PROTOCOL_LIST \
  3268. $INDEV_LIST \
  3269. $OUTDEV_LIST \
  3270. cat >>config.mak <<EOF
  3271. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3272. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3273. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3274. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3275. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3276. EOF
  3277. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  3278. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  3279. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3280. cp_if_changed $TMPH config.h
  3281. touch .config
  3282. enabled yasm && cp_if_changed $TMPASM config.asm
  3283. cat > $TMPH <<EOF
  3284. /* Generated by ffconf */
  3285. #ifndef AVUTIL_AVCONFIG_H
  3286. #define AVUTIL_AVCONFIG_H
  3287. EOF
  3288. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3289. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3290. cp_if_changed $TMPH libavutil/avconfig.h
  3291. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3292. # build pkg-config files
  3293. pkgconfig_generate(){
  3294. name=$1
  3295. shortname=${name#lib}${build_suffix}
  3296. comment=$2
  3297. version=$3
  3298. libs=$4
  3299. requires=$5
  3300. enabled ${name#lib} || return 0
  3301. mkdir -p $name
  3302. cat <<EOF > $name/$name.pc
  3303. prefix=$prefix
  3304. exec_prefix=\${prefix}
  3305. libdir=$libdir
  3306. includedir=$incdir
  3307. Name: $name
  3308. Description: $comment
  3309. Version: $version
  3310. Requires: $(enabled shared || echo $requires)
  3311. Requires.private: $(enabled shared && echo $requires)
  3312. Conflicts:
  3313. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3314. Libs.private: $(enabled shared && echo $libs)
  3315. Cflags: -I\${includedir}
  3316. EOF
  3317. cat <<EOF > $name/$name-uninstalled.pc
  3318. prefix=
  3319. exec_prefix=
  3320. libdir=\${pcfiledir}
  3321. includedir=${source_path}
  3322. Name: $name
  3323. Description: $comment
  3324. Version: $version
  3325. Requires: $requires
  3326. Conflicts:
  3327. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3328. Cflags: -I\${includedir}
  3329. EOF
  3330. }
  3331. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3332. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3333. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3334. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3335. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  3336. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3337. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
  3338. pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"