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.

4276 lines
126KB

  1. #!/bin/sh
  2. #
  3. # Libav 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 LIBAV, 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 Libav."
  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. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --list-decoders show all available decoders
  58. --list-encoders show all available encoders
  59. --list-hwaccels show all available hardware accelerators
  60. --list-demuxers show all available demuxers
  61. --list-muxers show all available muxers
  62. --list-parsers show all available parsers
  63. --list-protocols show all available protocols
  64. --list-bsfs show all available bitstream filters
  65. --list-indevs show all available input devices
  66. --list-outdevs show all available output devices
  67. --list-filters show all available filters
  68. Standard options:
  69. --logfile=FILE log tests and output to FILE [config.log]
  70. --disable-logging do not log configure debug information
  71. --prefix=PREFIX install in PREFIX [$prefix]
  72. --bindir=DIR install binaries in DIR [PREFIX/bin]
  73. --datadir=DIR install data files in DIR [PREFIX/share/avconv]
  74. --libdir=DIR install libs in DIR [PREFIX/lib]
  75. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  76. --incdir=DIR install includes in DIR [PREFIX/include]
  77. --mandir=DIR install man page in DIR [PREFIX/share/man]
  78. Licensing options:
  79. --enable-gpl allow use of GPL code, the resulting libs
  80. and binaries will be under GPL [no]
  81. --enable-version3 upgrade (L)GPL to version 3 [no]
  82. --enable-nonfree allow use of nonfree code, the resulting libs
  83. and binaries will be unredistributable [no]
  84. Configuration options:
  85. --disable-static do not build static libraries [no]
  86. --enable-shared build shared libraries [no]
  87. --enable-small optimize for size instead of speed
  88. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  89. --enable-gray enable full grayscale support (slower color)
  90. --disable-swscale-alpha disable alpha channel support in swscale
  91. --disable-all disable building components, libraries and programs
  92. Program options:
  93. --disable-programs do not build command line programs
  94. --disable-avconv disable avconv build
  95. --disable-avplay disable avplay build
  96. --disable-avprobe disable avprobe build
  97. --disable-avserver disable avserver build
  98. Component options:
  99. --disable-doc do not build documentation
  100. --disable-avdevice disable libavdevice build
  101. --disable-avcodec disable libavcodec build
  102. --disable-avformat disable libavformat build
  103. --disable-avutil disable libavutil build
  104. --disable-swscale disable libswscale build
  105. --disable-avfilter disable video filter support [no]
  106. --disable-avresample disable libavresample build [no]
  107. --disable-pthreads disable pthreads [auto]
  108. --disable-w32threads disable Win32 threads [auto]
  109. --disable-network disable network support [no]
  110. --disable-dct disable DCT code
  111. --disable-error-resilience disable error resilience code
  112. --disable-lsp disable LSP code
  113. --disable-lzo disable LZO decoder code
  114. --disable-mdct disable MDCT code
  115. --disable-rdft disable RDFT code
  116. --disable-fft disable FFT code
  117. Hardware accelerators:
  118. --enable-dxva2 enable DXVA2 code
  119. --enable-vaapi enable VAAPI code
  120. --enable-vda enable VDA code
  121. --enable-vdpau enable VDPAU code
  122. Individual component options:
  123. --disable-everything disable all components listed below
  124. --disable-encoder=NAME disable encoder NAME
  125. --enable-encoder=NAME enable encoder NAME
  126. --disable-encoders disable all encoders
  127. --disable-decoder=NAME disable decoder NAME
  128. --enable-decoder=NAME enable decoder NAME
  129. --disable-decoders disable all decoders
  130. --disable-hwaccel=NAME disable hwaccel NAME
  131. --enable-hwaccel=NAME enable hwaccel NAME
  132. --disable-hwaccels disable all hwaccels
  133. --disable-muxer=NAME disable muxer NAME
  134. --enable-muxer=NAME enable muxer NAME
  135. --disable-muxers disable all muxers
  136. --disable-demuxer=NAME disable demuxer NAME
  137. --enable-demuxer=NAME enable demuxer NAME
  138. --disable-demuxers disable all demuxers
  139. --enable-parser=NAME enable parser NAME
  140. --disable-parser=NAME disable parser NAME
  141. --disable-parsers disable all parsers
  142. --enable-bsf=NAME enable bitstream filter NAME
  143. --disable-bsf=NAME disable bitstream filter NAME
  144. --disable-bsfs disable all bitstream filters
  145. --enable-protocol=NAME enable protocol NAME
  146. --disable-protocol=NAME disable protocol NAME
  147. --disable-protocols disable all protocols
  148. --enable-indev=NAME enable input device NAME
  149. --disable-indev=NAME disable input device NAME
  150. --disable-indevs disable input devices
  151. --enable-outdev=NAME enable output device NAME
  152. --disable-outdev=NAME disable output device NAME
  153. --disable-outdevs disable output devices
  154. --disable-devices disable all devices
  155. --enable-filter=NAME enable filter NAME
  156. --disable-filter=NAME disable filter NAME
  157. --disable-filters disable all filters
  158. External library support:
  159. --enable-avisynth enable reading of AVISynth script files [no]
  160. --enable-bzlib enable bzlib [autodetect]
  161. --enable-frei0r enable frei0r video filtering
  162. --enable-gnutls enable gnutls [no]
  163. --enable-libcdio enable audio CD grabbing with libcdio
  164. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  165. and libraw1394 [no]
  166. --enable-libfaac enable AAC encoding via libfaac [no]
  167. --enable-libfdk-aac enable AAC encoding via libfdk-aac [no]
  168. --enable-libfreetype enable libfreetype [no]
  169. --enable-libgsm enable GSM de/encoding via libgsm [no]
  170. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  171. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  172. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  173. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  174. --enable-libopencv enable video filtering via libopencv [no]
  175. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  176. --enable-libopus enable Opus decoding via libopus [no]
  177. --enable-libpulse enable Pulseaudio input via libpulse [no]
  178. --enable-librtmp enable RTMP[E] support via librtmp [no]
  179. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  180. --enable-libspeex enable Speex de/encoding via libspeex [no]
  181. --enable-libtheora enable Theora encoding via libtheora [no]
  182. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  183. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  184. --enable-libvorbis enable Vorbis encoding via libvorbis [no]
  185. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  186. --enable-libx264 enable H.264 encoding via x264 [no]
  187. --enable-libxavs enable AVS encoding via xavs [no]
  188. --enable-libxvid enable Xvid encoding via xvidcore,
  189. native MPEG-4/Xvid encoder exists [no]
  190. --enable-openssl enable openssl [no]
  191. --enable-x11grab enable X11 grabbing [no]
  192. --enable-zlib enable zlib [autodetect]
  193. Advanced options (experts only):
  194. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  195. --enable-cross-compile assume a cross-compiler is used
  196. --sysroot=PATH root of cross-build tree
  197. --sysinclude=PATH location of cross-build system headers
  198. --target-os=OS compiler targets OS [$target_os]
  199. --target-exec=CMD command to run executables on target
  200. --target-path=DIR path to view of build directory on target
  201. --target-samples=DIR path to samples directory on target
  202. --toolchain=NAME set tool defaults according to NAME
  203. --nm=NM use nm tool
  204. --ar=AR use archive tool AR [$ar_default]
  205. --as=AS use assembler AS [$as_default]
  206. --cc=CC use C compiler CC [$cc_default]
  207. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  208. --ld=LD use linker LD
  209. --host-cc=HOSTCC use host C compiler HOSTCC
  210. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  211. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  212. --host-ld=HOSTLD use host linker HOSTLD
  213. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  214. --host-libs=HLIBS use libs HLIBS when linking for host
  215. --host-os=OS compiler host OS [$target_os]
  216. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  217. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  218. --extra-libs=ELIBS add ELIBS [$ELIBS]
  219. --extra-version=STRING version string suffix []
  220. --optflags=OPTFLAGS override optimization-related compiler flags
  221. --build-suffix=SUFFIX library name suffix []
  222. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  223. --arch=ARCH select architecture [$arch]
  224. --cpu=CPU select the minimum required CPU (affects
  225. instruction selection, may crash on older CPUs)
  226. --enable-pic build position-independent code
  227. --enable-sram allow use of on-chip SRAM
  228. --enable-thumb compile for Thumb instruction set
  229. --disable-symver disable symbol versioning
  230. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  231. --disable-safe-bitstream-reader
  232. disable buffer boundary checking in bitreaders
  233. (faster, but may crash)
  234. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  235. --enable-lto use link-time optimization
  236. Optimization options (experts only):
  237. --disable-asm disable all assembler optimizations
  238. --disable-altivec disable AltiVec optimizations
  239. --disable-amd3dnow disable 3DNow! optimizations
  240. --disable-amd3dnowext disable 3DNow! extended optimizations
  241. --disable-mmx disable MMX optimizations
  242. --disable-mmxext disable MMXEXT optimizations
  243. --disable-sse disable SSE optimizations
  244. --disable-sse2 disable SSE2 optimizations
  245. --disable-sse3 disable SSE3 optimizations
  246. --disable-ssse3 disable SSSE3 optimizations
  247. --disable-sse4 disable SSE4 optimizations
  248. --disable-sse42 disable SSE4.2 optimizations
  249. --disable-avx disable AVX optimizations
  250. --disable-fma4 disable FMA4 optimizations
  251. --disable-armv5te disable armv5te optimizations
  252. --disable-armv6 disable armv6 optimizations
  253. --disable-armv6t2 disable armv6t2 optimizations
  254. --disable-vfp disable VFP optimizations
  255. --disable-neon disable NEON optimizations
  256. --disable-vis disable VIS optimizations
  257. --disable-inline-asm disable use of inline assembler
  258. --disable-yasm disable use of yasm assembler
  259. Developer options (useful when working on Libav itself):
  260. --disable-debug disable debugging symbols
  261. --enable-debug=LEVEL set the debug level [$debuglevel]
  262. --disable-optimizations disable compiler optimizations
  263. --enable-extra-warnings enable more compiler warnings
  264. --samples=PATH location of test samples for FATE, if not set use
  265. \$LIBAV_SAMPLES at make invocation time.
  266. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  267. should be used only for debugging purposes)
  268. --enable-random randomly enable/disable components
  269. --disable-random
  270. --enable-random=LIST randomly enable/disable specific components or
  271. --disable-random=LIST component groups. LIST is a comma-separated list
  272. of NAME[:PROB] entries where NAME is a component
  273. (group) and PROB the probability associated with
  274. NAME (default 0.5).
  275. --random-seed=VALUE seed value for --enable/disable-random
  276. NOTE: Object files are built at the place where configure is launched.
  277. EOF
  278. exit 0
  279. }
  280. quotes='""'
  281. log(){
  282. echo "$@" >> $logfile
  283. }
  284. log_file(){
  285. log BEGIN $1
  286. pr -n -t $1 >> $logfile
  287. log END $1
  288. }
  289. echolog(){
  290. log "$@"
  291. echo "$@"
  292. }
  293. warn(){
  294. log "WARNING: $*"
  295. WARNINGS="${WARNINGS}WARNING: $*\n"
  296. }
  297. die(){
  298. echolog "$@"
  299. cat <<EOF
  300. If you think configure made a mistake, make sure you are using the latest
  301. version from Git. If the latest version fails, report the problem to the
  302. libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
  303. EOF
  304. if disabled logging; then
  305. cat <<EOF
  306. Rerun configure with logging enabled (do not use --disable-logging), and
  307. include the log this produces with your report.
  308. EOF
  309. else
  310. cat <<EOF
  311. Include the log file "$logfile" produced by configure as this will help
  312. solving the problem.
  313. EOF
  314. fi
  315. exit 1
  316. }
  317. # Avoid locale weirdness, besides we really just want to translate ASCII.
  318. toupper(){
  319. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  320. }
  321. tolower(){
  322. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  323. }
  324. c_escape(){
  325. echo "$*" | sed 's/["\\]/\\\0/g'
  326. }
  327. sh_quote(){
  328. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  329. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  330. echo "$v"
  331. }
  332. cleanws(){
  333. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  334. }
  335. filter(){
  336. pat=$1
  337. shift
  338. for v; do
  339. eval "case $v in $pat) echo $v ;; esac"
  340. done
  341. }
  342. filter_out(){
  343. pat=$1
  344. shift
  345. for v; do
  346. eval "case $v in $pat) ;; *) echo $v ;; esac"
  347. done
  348. }
  349. map(){
  350. m=$1
  351. shift
  352. for v; do eval $m; done
  353. }
  354. add_suffix(){
  355. suffix=$1
  356. shift
  357. for v; do echo ${v}${suffix}; done
  358. }
  359. set_all(){
  360. value=$1
  361. shift
  362. for var in $*; do
  363. eval $var=$value
  364. done
  365. }
  366. set_weak(){
  367. value=$1
  368. shift
  369. for var; do
  370. eval : \${$var:=$value}
  371. done
  372. }
  373. sanitize_var_name(){
  374. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  375. }
  376. set_safe(){
  377. var=$1
  378. shift
  379. eval $(sanitize_var_name "$var")='$*'
  380. }
  381. get_safe(){
  382. eval echo \$$(sanitize_var_name "$1")
  383. }
  384. pushvar(){
  385. for pvar in $*; do
  386. eval level=\${${pvar}_level:=0}
  387. eval ${pvar}_${level}="\$$pvar"
  388. eval ${pvar}_level=$(($level+1))
  389. done
  390. }
  391. popvar(){
  392. for pvar in $*; do
  393. eval level=\${${pvar}_level:-0}
  394. test $level = 0 && continue
  395. eval level=$(($level-1))
  396. eval $pvar="\${${pvar}_${level}}"
  397. eval ${pvar}_level=$level
  398. eval unset ${pvar}_${level}
  399. done
  400. }
  401. enable(){
  402. set_all yes $*
  403. }
  404. disable(){
  405. set_all no $*
  406. }
  407. enable_weak(){
  408. set_weak yes $*
  409. }
  410. disable_weak(){
  411. set_weak no $*
  412. }
  413. enable_safe(){
  414. for var; do
  415. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  416. done
  417. }
  418. disable_safe(){
  419. for var; do
  420. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  421. done
  422. }
  423. do_enable_deep(){
  424. for var; do
  425. enabled $var && continue
  426. eval sel="\$${var}_select"
  427. eval sgs="\$${var}_suggest"
  428. pushvar var sgs
  429. enable_deep $sel
  430. popvar sgs
  431. enable_deep_weak $sgs
  432. popvar var
  433. done
  434. }
  435. enable_deep(){
  436. do_enable_deep $*
  437. enable $*
  438. }
  439. enable_deep_weak(){
  440. for var; do
  441. disabled $var && continue
  442. pushvar var
  443. do_enable_deep $var
  444. popvar var
  445. enable_weak $var
  446. done
  447. }
  448. enabled(){
  449. test "${1#!}" = "$1" && op== || op=!=
  450. eval test "x\$${1#!}" $op "xyes"
  451. }
  452. disabled(){
  453. test "${1#!}" = "$1" && op== || op=!=
  454. eval test "x\$${1#!}" $op "xno"
  455. }
  456. enabled_all(){
  457. for opt; do
  458. enabled $opt || return 1
  459. done
  460. }
  461. disabled_all(){
  462. for opt; do
  463. disabled $opt || return 1
  464. done
  465. }
  466. enabled_any(){
  467. for opt; do
  468. enabled $opt && return 0
  469. done
  470. }
  471. disabled_any(){
  472. for opt; do
  473. disabled $opt && return 0
  474. done
  475. return 1
  476. }
  477. set_default(){
  478. for opt; do
  479. eval : \${$opt:=\$${opt}_default}
  480. done
  481. }
  482. is_in(){
  483. value=$1
  484. shift
  485. for var in $*; do
  486. [ $var = $value ] && return 0
  487. done
  488. return 1
  489. }
  490. do_check_deps(){
  491. for cfg; do
  492. cfg="${cfg#!}"
  493. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  494. disabled ${cfg}_checking && continue
  495. enable ${cfg}_checking
  496. append allopts $cfg
  497. eval dep_all="\$${cfg}_deps"
  498. eval dep_any="\$${cfg}_deps_any"
  499. eval dep_sel="\$${cfg}_select"
  500. eval dep_sgs="\$${cfg}_suggest"
  501. eval dep_ifa="\$${cfg}_if"
  502. eval dep_ifn="\$${cfg}_if_any"
  503. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  504. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  505. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  506. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  507. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  508. enabled_all $dep_all || disable $cfg
  509. enabled_any $dep_any || disable $cfg
  510. disabled_any $dep_sel && disable $cfg
  511. if enabled $cfg; then
  512. enable_deep $dep_sel
  513. enable_deep_weak $dep_sgs
  514. fi
  515. disable ${cfg}_checking
  516. done
  517. }
  518. check_deps(){
  519. unset allopts
  520. do_check_deps "$@"
  521. for cfg in $allopts; do
  522. enabled $cfg || continue
  523. eval dep_extralibs="\$${cfg}_extralibs"
  524. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  525. done
  526. }
  527. print_config(){
  528. pfx=$1
  529. files=$2
  530. shift 2
  531. map 'eval echo "$v \${$v:-no}"' "$@" |
  532. awk "BEGIN { split(\"$files\", files) }
  533. {
  534. c = \"$pfx\" toupper(\$1);
  535. v = \$2;
  536. sub(/yes/, 1, v);
  537. sub(/no/, 0, v);
  538. for (f in files) {
  539. file = files[f];
  540. if (file ~ /\\.h\$/) {
  541. printf(\"#define %s %d\\n\", c, v) >>file;
  542. } else if (file ~ /\\.asm\$/) {
  543. printf(\"%%define %s %d\\n\", c, v) >>file;
  544. } else if (file ~ /\\.mak\$/) {
  545. n = -v ? \"\" : \"!\";
  546. printf(\"%s%s=yes\\n\", n, c) >>file;
  547. }
  548. }
  549. }"
  550. }
  551. print_enabled(){
  552. suf=$1
  553. shift
  554. for v; do
  555. enabled $v && printf "%s\n" ${v%$suf};
  556. done
  557. }
  558. append(){
  559. var=$1
  560. shift
  561. eval "$var=\"\$$var $*\""
  562. }
  563. prepend(){
  564. var=$1
  565. shift
  566. eval "$var=\"$* \$$var\""
  567. }
  568. add_cppflags(){
  569. append CPPFLAGS "$@"
  570. }
  571. add_cflags(){
  572. append CFLAGS $($cflags_filter "$@")
  573. }
  574. add_asflags(){
  575. append ASFLAGS $($asflags_filter "$@")
  576. }
  577. add_ldflags(){
  578. append LDFLAGS $($ldflags_filter "$@")
  579. }
  580. add_extralibs(){
  581. prepend extralibs $($ldflags_filter "$@")
  582. }
  583. add_host_cppflags(){
  584. append host_cppflags "$@"
  585. }
  586. add_host_cflags(){
  587. append host_cflags $($host_cflags_filter "$@")
  588. }
  589. add_host_ldflags(){
  590. append host_ldflags $($host_ldflags_filter "$@")
  591. }
  592. add_compat(){
  593. append compat_objs $1
  594. shift
  595. map 'add_cppflags -D$v' "$@"
  596. }
  597. check_cmd(){
  598. log "$@"
  599. "$@" >> $logfile 2>&1
  600. }
  601. cc_o(){
  602. eval printf '%s\\n' $CC_O
  603. }
  604. cc_e(){
  605. eval printf '%s\\n' $CC_E
  606. }
  607. check_cc(){
  608. log check_cc "$@"
  609. cat > $TMPC
  610. log_file $TMPC
  611. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  612. }
  613. check_cpp(){
  614. log check_cpp "$@"
  615. cat > $TMPC
  616. log_file $TMPC
  617. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  618. }
  619. as_o(){
  620. eval printf '%s\\n' $AS_O
  621. }
  622. check_as(){
  623. log check_as "$@"
  624. cat > $TMPS
  625. log_file $TMPS
  626. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  627. }
  628. check_inline_asm(){
  629. log check_inline_asm "$@"
  630. name="$1"
  631. code="$2"
  632. shift 2
  633. disable $name
  634. check_cc "$@" <<EOF && enable $name
  635. void foo(void){ __asm__ volatile($code); }
  636. EOF
  637. }
  638. check_insn(){
  639. log check_insn "$@"
  640. check_inline_asm ${1}_inline "\"$2\""
  641. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  642. }
  643. check_yasm(){
  644. log check_yasm "$@"
  645. echo "$1" > $TMPS
  646. log_file $TMPS
  647. shift 1
  648. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  649. }
  650. ld_o(){
  651. eval printf '%s\\n' $LD_O
  652. }
  653. check_ld(){
  654. log check_ld "$@"
  655. flags=$(filter_out '-l*' "$@")
  656. libs=$(filter '-l*' "$@")
  657. check_cc $($cflags_filter $flags) || return
  658. flags=$($ldflags_filter $flags)
  659. libs=$($ldflags_filter $libs)
  660. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  661. }
  662. check_code(){
  663. log check_code "$@"
  664. check=$1
  665. headers=$2
  666. code=$3
  667. shift 3
  668. {
  669. for hdr in $headers; do
  670. echo "#include <$hdr>"
  671. done
  672. echo "int main(void) { $code; return 0; }"
  673. } | check_$check "$@"
  674. }
  675. check_cppflags(){
  676. log check_cppflags "$@"
  677. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  678. int x;
  679. EOF
  680. }
  681. check_cflags(){
  682. log check_cflags "$@"
  683. set -- $($cflags_filter "$@")
  684. check_cc "$@" <<EOF && append CFLAGS "$@"
  685. int x;
  686. EOF
  687. }
  688. test_ldflags(){
  689. log test_ldflags "$@"
  690. check_ld "$@" <<EOF
  691. int main(void){ return 0; }
  692. EOF
  693. }
  694. check_ldflags(){
  695. log check_ldflags "$@"
  696. test_ldflags "$@" && add_ldflags "$@"
  697. }
  698. check_header(){
  699. log check_header "$@"
  700. header=$1
  701. shift
  702. disable_safe $header
  703. check_cpp "$@" <<EOF && enable_safe $header
  704. #include <$header>
  705. int x;
  706. EOF
  707. }
  708. check_func(){
  709. log check_func "$@"
  710. func=$1
  711. shift
  712. disable $func
  713. check_ld "$@" <<EOF && enable $func
  714. extern int $func();
  715. int main(void){ $func(); }
  716. EOF
  717. }
  718. check_mathfunc(){
  719. log check_mathfunc "$@"
  720. func=$1
  721. narg=$2
  722. shift 2
  723. test $narg = 2 && args="f, g" || args="f"
  724. disable $func
  725. check_ld "$@" <<EOF && enable $func
  726. #include <math.h>
  727. float foo(float f, float g) { return $func($args); }
  728. int main(void){ return 0; }
  729. EOF
  730. }
  731. check_func_headers(){
  732. log check_func_headers "$@"
  733. headers=$1
  734. funcs=$2
  735. shift 2
  736. {
  737. for hdr in $headers; do
  738. echo "#include <$hdr>"
  739. done
  740. for func in $funcs; do
  741. echo "long check_$func(void) { return (long) $func; }"
  742. done
  743. echo "int main(void) { return 0; }"
  744. } | check_ld "$@" && enable $funcs && enable_safe $headers
  745. }
  746. check_cpp_condition(){
  747. log check_cpp_condition "$@"
  748. header=$1
  749. condition=$2
  750. shift 2
  751. check_cpp "$@" <<EOF
  752. #include <$header>
  753. #if !($condition)
  754. #error "unsatisfied condition: $condition"
  755. #endif
  756. EOF
  757. }
  758. check_lib(){
  759. log check_lib "$@"
  760. header="$1"
  761. func="$2"
  762. shift 2
  763. check_header $header && check_func $func "$@" && add_extralibs "$@"
  764. }
  765. check_lib2(){
  766. log check_lib2 "$@"
  767. headers="$1"
  768. funcs="$2"
  769. shift 2
  770. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  771. }
  772. check_pkg_config(){
  773. log check_pkg_config "$@"
  774. pkg="$1"
  775. headers="$2"
  776. funcs="$3"
  777. shift 3
  778. $pkg_config --exists $pkg || return
  779. pkg_cflags=$($pkg_config --cflags $pkg)
  780. pkg_libs=$($pkg_config --libs $pkg)
  781. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  782. set_safe ${pkg}_cflags $pkg_cflags &&
  783. set_safe ${pkg}_libs $pkg_libs
  784. }
  785. check_exec(){
  786. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  787. }
  788. check_exec_crash(){
  789. code=$(cat)
  790. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  791. # are safe but may not be available everywhere. Thus we use
  792. # raise(SIGTERM) instead. The check is run in a subshell so we
  793. # can redirect the "Terminated" message from the shell. SIGBUS
  794. # is not defined by standard C so it is used conditionally.
  795. (check_exec "$@") >> $logfile 2>&1 <<EOF
  796. #include <signal.h>
  797. static void sighandler(int sig){
  798. raise(SIGTERM);
  799. }
  800. int foo(void){
  801. $code
  802. }
  803. int (*func_ptr)(void) = foo;
  804. int main(void){
  805. signal(SIGILL, sighandler);
  806. signal(SIGFPE, sighandler);
  807. signal(SIGSEGV, sighandler);
  808. #ifdef SIGBUS
  809. signal(SIGBUS, sighandler);
  810. #endif
  811. return func_ptr();
  812. }
  813. EOF
  814. }
  815. check_type(){
  816. log check_type "$@"
  817. headers=$1
  818. type=$2
  819. shift 2
  820. disable_safe "$type"
  821. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  822. }
  823. check_struct(){
  824. log check_struct "$@"
  825. headers=$1
  826. struct=$2
  827. member=$3
  828. shift 3
  829. disable_safe "${struct}_${member}"
  830. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  831. enable_safe "${struct}_${member}"
  832. }
  833. check_builtin(){
  834. log check_builtin "$@"
  835. name=$1
  836. headers=$2
  837. builtin=$3
  838. shift 3
  839. disable "$name"
  840. check_code ld "$headers" "$builtin" "$@" && enable "$name"
  841. }
  842. require(){
  843. name="$1"
  844. header="$2"
  845. func="$3"
  846. shift 3
  847. check_lib $header $func "$@" || die "ERROR: $name not found"
  848. }
  849. require2(){
  850. name="$1"
  851. headers="$2"
  852. func="$3"
  853. shift 3
  854. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  855. }
  856. require_pkg_config(){
  857. pkg="$1"
  858. check_pkg_config "$@" || die "ERROR: $pkg not found"
  859. add_cflags $(get_safe ${pkg}_cflags)
  860. add_extralibs $(get_safe ${pkg}_libs)
  861. }
  862. hostcc_o(){
  863. eval printf '%s\\n' $HOSTCC_O
  864. }
  865. check_host_cc(){
  866. log check_host_cc "$@"
  867. cat > $TMPC
  868. log_file $TMPC
  869. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  870. }
  871. check_host_cppflags(){
  872. log check_host_cppflags "$@"
  873. check_host_cc "$@" <<EOF && append host_cppflags "$@"
  874. int x;
  875. EOF
  876. }
  877. check_host_cflags(){
  878. log check_host_cflags "$@"
  879. set -- $($host_cflags_filter "$@")
  880. check_host_cc "$@" <<EOF && append host_cflags "$@"
  881. int x;
  882. EOF
  883. }
  884. apply(){
  885. file=$1
  886. shift
  887. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  888. }
  889. cp_if_changed(){
  890. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  891. mkdir -p "$(dirname $2)"
  892. $cp_f "$1" "$2"
  893. }
  894. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  895. # system-dependent things.
  896. COMPONENT_LIST="
  897. bsfs
  898. decoders
  899. demuxers
  900. encoders
  901. filters
  902. hwaccels
  903. indevs
  904. muxers
  905. outdevs
  906. parsers
  907. protocols
  908. "
  909. EXTERNAL_LIBRARY_LIST="
  910. avisynth
  911. bzlib
  912. frei0r
  913. gnutls
  914. libcdio
  915. libdc1394
  916. libfaac
  917. libfdk_aac
  918. libfreetype
  919. libgsm
  920. libilbc
  921. libmp3lame
  922. libopencore_amrnb
  923. libopencore_amrwb
  924. libopencv
  925. libopenjpeg
  926. libopus
  927. libpulse
  928. librtmp
  929. libschroedinger
  930. libspeex
  931. libtheora
  932. libvo_aacenc
  933. libvo_amrwbenc
  934. libvorbis
  935. libvpx
  936. libx264
  937. libxavs
  938. libxvid
  939. openssl
  940. x11grab
  941. zlib
  942. "
  943. HWACCEL_LIST="
  944. dxva2
  945. vaapi
  946. vda
  947. vdpau
  948. "
  949. LIBRARY_LIST="
  950. avcodec
  951. avdevice
  952. avfilter
  953. avformat
  954. avresample
  955. avutil
  956. swscale
  957. "
  958. PROGRAM_LIST="
  959. avconv
  960. avplay
  961. avprobe
  962. avserver
  963. "
  964. CONFIG_LIST="
  965. $COMPONENT_LIST
  966. $EXTERNAL_LIBRARY_LIST
  967. $HWACCEL_LIST
  968. $LIBRARY_LIST
  969. $PROGRAM_LIST
  970. dct
  971. doc
  972. error_resilience
  973. fft
  974. gpl
  975. gray
  976. hardcoded_tables
  977. lsp
  978. lzo
  979. mdct
  980. memalign_hack
  981. network
  982. nonfree
  983. pic
  984. rdft
  985. runtime_cpudetect
  986. safe_bitstream_reader
  987. shared
  988. small
  989. sram
  990. static
  991. swscale_alpha
  992. thumb
  993. version3
  994. xmm_clobber_test
  995. "
  996. THREADS_LIST='
  997. pthreads
  998. w32threads
  999. '
  1000. ATOMICS_LIST='
  1001. atomics_gcc
  1002. atomics_suncc
  1003. atomics_win32
  1004. '
  1005. ARCH_LIST='
  1006. aarch64
  1007. alpha
  1008. arm
  1009. avr32
  1010. avr32_ap
  1011. avr32_uc
  1012. bfin
  1013. ia64
  1014. m68k
  1015. mips
  1016. mips64
  1017. parisc
  1018. ppc
  1019. ppc64
  1020. s390
  1021. sh4
  1022. sparc
  1023. sparc64
  1024. tilegx
  1025. tilepro
  1026. tomi
  1027. x86
  1028. x86_32
  1029. x86_64
  1030. '
  1031. ARCH_EXT_LIST_ARM='
  1032. armv5te
  1033. armv6
  1034. armv6t2
  1035. neon
  1036. vfp
  1037. vfpv3
  1038. '
  1039. ARCH_EXT_LIST_X86='
  1040. amd3dnow
  1041. amd3dnowext
  1042. avx
  1043. fma4
  1044. mmx
  1045. mmxext
  1046. sse
  1047. sse2
  1048. sse3
  1049. sse4
  1050. sse42
  1051. ssse3
  1052. '
  1053. ARCH_EXT_LIST="
  1054. $ARCH_EXT_LIST_ARM
  1055. $ARCH_EXT_LIST_X86
  1056. altivec
  1057. ppc4xx
  1058. vis
  1059. "
  1060. HAVE_LIST_CMDLINE='
  1061. inline_asm
  1062. symver
  1063. yasm
  1064. '
  1065. HAVE_LIST_PUB='
  1066. bigendian
  1067. fast_unaligned
  1068. '
  1069. MATH_FUNCS="
  1070. atanf
  1071. atan2f
  1072. cbrtf
  1073. cosf
  1074. exp2
  1075. exp2f
  1076. expf
  1077. isinf
  1078. isnan
  1079. ldexpf
  1080. llrint
  1081. llrintf
  1082. log2
  1083. log2f
  1084. log10f
  1085. lrint
  1086. lrintf
  1087. powf
  1088. rint
  1089. round
  1090. roundf
  1091. sinf
  1092. trunc
  1093. truncf
  1094. "
  1095. HAVE_LIST="
  1096. $ARCH_EXT_LIST
  1097. $(add_suffix _external $ARCH_EXT_LIST)
  1098. $(add_suffix _inline $ARCH_EXT_LIST)
  1099. $HAVE_LIST_CMDLINE
  1100. $HAVE_LIST_PUB
  1101. $THREADS_LIST
  1102. $ATOMICS_LIST
  1103. $MATH_FUNCS
  1104. aligned_malloc
  1105. aligned_stack
  1106. alsa_asoundlib_h
  1107. altivec_h
  1108. arpa_inet_h
  1109. asm_mod_q
  1110. asm_mod_y
  1111. atomic_cas_ptr
  1112. atomics_native
  1113. attribute_may_alias
  1114. attribute_packed
  1115. cdio_paranoia_h
  1116. cdio_paranoia_paranoia_h
  1117. closesocket
  1118. CommandLineToArgvW
  1119. cpunop
  1120. CryptGenRandom
  1121. dcbzl
  1122. dev_bktr_ioctl_bt848_h
  1123. dev_bktr_ioctl_meteor_h
  1124. dev_ic_bt8xx_h
  1125. dev_video_bktr_ioctl_bt848_h
  1126. dev_video_meteor_ioctl_meteor_h
  1127. direct_h
  1128. dlfcn_h
  1129. dlopen
  1130. dos_paths
  1131. dxva_h
  1132. ebp_available
  1133. ebx_available
  1134. fast_64bit
  1135. fast_clz
  1136. fast_cmov
  1137. fcntl
  1138. fork
  1139. getaddrinfo
  1140. gethrtime
  1141. getopt
  1142. GetProcessAffinityMask
  1143. GetProcessMemoryInfo
  1144. GetProcessTimes
  1145. GetSystemTimeAsFileTime
  1146. getrusage
  1147. getservbyport
  1148. gettimeofday
  1149. gnu_as
  1150. gsm_h
  1151. i686
  1152. ibm_asm
  1153. inet_aton
  1154. io_h
  1155. isatty
  1156. jack_port_get_latency_range
  1157. ldbrx
  1158. libdc1394_1
  1159. libdc1394_2
  1160. local_aligned_16
  1161. local_aligned_8
  1162. localtime_r
  1163. loongson
  1164. machine_ioctl_bt848_h
  1165. machine_ioctl_meteor_h
  1166. machine_rw_barrier
  1167. malloc_h
  1168. MapViewOfFile
  1169. memalign
  1170. MemoryBarrier
  1171. mkstemp
  1172. mm_empty
  1173. mmap
  1174. mprotect
  1175. msvcrt
  1176. nanosleep
  1177. poll_h
  1178. posix_memalign
  1179. rdtsc
  1180. sched_getaffinity
  1181. sdl
  1182. SetConsoleTextAttribute
  1183. setmode
  1184. setrlimit
  1185. Sleep
  1186. sndio_h
  1187. socklen_t
  1188. soundcard_h
  1189. strerror_r
  1190. strptime
  1191. strtok_r
  1192. struct_addrinfo
  1193. struct_group_source_req
  1194. struct_ip_mreq_source
  1195. struct_ipv6_mreq
  1196. struct_pollfd
  1197. struct_rusage_ru_maxrss
  1198. struct_sockaddr_in6
  1199. struct_sockaddr_sa_len
  1200. struct_sockaddr_storage
  1201. struct_v4l2_frmivalenum_discrete
  1202. symver_asm_label
  1203. symver_gnu_asm
  1204. sync_val_compare_and_swap
  1205. sysconf
  1206. sysctl
  1207. sys_mman_h
  1208. sys_param_h
  1209. sys_resource_h
  1210. sys_select_h
  1211. sys_soundcard_h
  1212. sys_time_h
  1213. sys_videoio_h
  1214. threads
  1215. unistd_h
  1216. usleep
  1217. vfp_args
  1218. VirtualAlloc
  1219. windows_h
  1220. winsock2_h
  1221. xform_asm
  1222. xmm_clobbers
  1223. "
  1224. # options emitted with CONFIG_ prefix but not available on the command line
  1225. CONFIG_EXTRA="
  1226. aandcttables
  1227. ac3dsp
  1228. audio_frame_queue
  1229. dsputil
  1230. gcrypt
  1231. golomb
  1232. gplv3
  1233. h264chroma
  1234. h264dsp
  1235. h264pred
  1236. h264qpel
  1237. hpeldsp
  1238. huffman
  1239. lgplv3
  1240. lpc
  1241. mpegaudio
  1242. mpegaudiodsp
  1243. mpegvideo
  1244. mpegvideoenc
  1245. nettle
  1246. rangecoder
  1247. rtpdec
  1248. rtpenc_chain
  1249. sinewin
  1250. videodsp
  1251. vp3dsp
  1252. "
  1253. CMDLINE_SELECT="
  1254. $ARCH_EXT_LIST
  1255. $CONFIG_LIST
  1256. $HAVE_LIST_CMDLINE
  1257. $THREADS_LIST
  1258. asm
  1259. cross_compile
  1260. debug
  1261. extra_warnings
  1262. logging
  1263. lto
  1264. optimizations
  1265. "
  1266. PATHS_LIST='
  1267. bindir
  1268. datadir
  1269. incdir
  1270. libdir
  1271. mandir
  1272. prefix
  1273. shlibdir
  1274. '
  1275. CMDLINE_SET="
  1276. $PATHS_LIST
  1277. ar
  1278. arch
  1279. as
  1280. build_suffix
  1281. cc
  1282. cpu
  1283. cross_prefix
  1284. dep_cc
  1285. extra_version
  1286. host_cc
  1287. host_cflags
  1288. host_ld
  1289. host_ldflags
  1290. host_libs
  1291. host_os
  1292. ld
  1293. logfile
  1294. malloc_prefix
  1295. nm
  1296. optflags
  1297. pkg_config
  1298. random_seed
  1299. samples
  1300. sysinclude
  1301. sysroot
  1302. target_exec
  1303. target_os
  1304. target_path
  1305. target_samples
  1306. toolchain
  1307. "
  1308. CMDLINE_APPEND="
  1309. extra_cflags
  1310. host_cppflags
  1311. "
  1312. # code dependency declarations
  1313. # architecture extensions
  1314. armv5te_deps="arm"
  1315. armv6_deps="arm"
  1316. armv6t2_deps="arm"
  1317. neon_deps="arm"
  1318. vfp_deps="arm"
  1319. vfpv3_deps="vfp"
  1320. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1321. altivec_deps="ppc"
  1322. ppc4xx_deps="ppc"
  1323. vis_deps="sparc"
  1324. x86_64_suggest="fast_cmov i686"
  1325. amd3dnow_deps="mmx"
  1326. amd3dnowext_deps="amd3dnow"
  1327. mmx_deps="x86"
  1328. mmxext_deps="mmx"
  1329. sse_deps="mmxext"
  1330. sse2_deps="sse"
  1331. sse3_deps="sse2"
  1332. ssse3_deps="sse3"
  1333. sse4_deps="ssse3"
  1334. sse42_deps="sse4"
  1335. avx_deps="sse42"
  1336. fma4_deps="avx"
  1337. mmx_external_deps="yasm"
  1338. mmx_inline_deps="inline_asm"
  1339. mmx_suggest="mmx_external mmx_inline"
  1340. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
  1341. eval dep=\$${ext}_deps
  1342. eval ${ext}_external_deps='"${dep}_external"'
  1343. eval ${ext}_inline_deps='"${dep}_inline"'
  1344. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1345. done
  1346. aligned_stack_if_any="ppc x86"
  1347. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1348. fast_clz_if_any="alpha avr32 mips ppc x86"
  1349. fast_unaligned_if_any="ppc x86"
  1350. inline_asm_deps="!tms470"
  1351. need_memalign="altivec neon sse"
  1352. symver_if_any="symver_asm_label symver_gnu_asm"
  1353. log2_deps="!msvcrt"
  1354. # subsystems
  1355. dct_select="rdft"
  1356. error_resilience_select="dsputil"
  1357. lpc_select="dsputil"
  1358. mdct_select="fft"
  1359. rdft_select="fft"
  1360. mpegaudio_select="mpegaudiodsp"
  1361. mpegaudiodsp_select="dct"
  1362. mpegvideo_select="dsputil hpeldsp videodsp"
  1363. mpegvideoenc_select="mpegvideo"
  1364. # decoders / encoders
  1365. aac_decoder_select="mdct sinewin"
  1366. aac_encoder_select="audio_frame_queue mdct sinewin"
  1367. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1368. ac3_decoder_select="mdct ac3dsp ac3_parser dsputil"
  1369. ac3_encoder_select="mdct ac3dsp dsputil"
  1370. ac3_fixed_encoder_select="mdct ac3dsp dsputil"
  1371. aic_decoder_select="dsputil golomb"
  1372. alac_encoder_select="lpc"
  1373. als_decoder_select="dsputil"
  1374. amrnb_decoder_select="lsp"
  1375. amrwb_decoder_select="lsp"
  1376. amv_decoder_select="dsputil hpeldsp"
  1377. ape_decoder_select="dsputil"
  1378. asv1_decoder_select="dsputil"
  1379. asv1_encoder_select="dsputil"
  1380. asv2_decoder_select="dsputil"
  1381. asv2_encoder_select="dsputil"
  1382. atrac1_decoder_select="mdct sinewin"
  1383. atrac3_decoder_select="mdct"
  1384. bink_decoder_select="dsputil hpeldsp"
  1385. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1386. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1387. cavs_decoder_select="dsputil golomb h264chroma videodsp"
  1388. cllc_decoder_select="dsputil"
  1389. comfortnoise_encoder_select="lpc"
  1390. cook_decoder_select="dsputil mdct sinewin"
  1391. cscd_decoder_select="lzo"
  1392. cscd_decoder_suggest="zlib"
  1393. dca_decoder_select="mdct"
  1394. dnxhd_decoder_select="dsputil"
  1395. dnxhd_encoder_select="aandcttables dsputil mpegvideoenc"
  1396. dvvideo_decoder_select="dsputil"
  1397. dvvideo_encoder_select="dsputil"
  1398. dxa_decoder_select="zlib"
  1399. eac3_decoder_select="ac3_decoder"
  1400. eac3_encoder_select="ac3_encoder"
  1401. eamad_decoder_select="aandcttables dsputil mpegvideo"
  1402. eatgq_decoder_select="aandcttables dsputil"
  1403. eatqi_decoder_select="aandcttables error_resilience mpegvideo"
  1404. ffv1_decoder_select="dsputil golomb rangecoder"
  1405. ffv1_encoder_select="dsputil rangecoder"
  1406. ffvhuff_decoder_select="dsputil"
  1407. ffvhuff_encoder_select="dsputil huffman"
  1408. flac_decoder_select="golomb"
  1409. flac_encoder_select="dsputil golomb lpc"
  1410. flashsv_decoder_select="zlib"
  1411. flashsv_encoder_select="zlib"
  1412. flashsv2_decoder_select="zlib"
  1413. flv_decoder_select="h263_decoder"
  1414. flv_encoder_select="h263_encoder"
  1415. fourxm_decoder_select="dsputil"
  1416. fraps_decoder_select="dsputil huffman"
  1417. g2m_decoder_select="dsputil zlib"
  1418. h261_decoder_select="error_resilience mpegvideo"
  1419. h261_encoder_select="aandcttables mpegvideoenc"
  1420. h263_decoder_select="error_resilience h263_parser mpegvideo"
  1421. h263_encoder_select="aandcttables mpegvideoenc"
  1422. h263i_decoder_select="h263_decoder"
  1423. h263p_encoder_select="h263_encoder"
  1424. h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1425. h264_decoder_suggest="error_resilience"
  1426. huffyuv_decoder_select="dsputil"
  1427. huffyuv_encoder_select="dsputil huffman"
  1428. iac_decoder_select="dsputil fft mdct sinewin"
  1429. imc_decoder_select="dsputil fft mdct sinewin"
  1430. indeo3_decoder_select="hpeldsp"
  1431. interplay_video_decoder_select="hpeldsp"
  1432. jpegls_decoder_select="dsputil golomb hpeldsp"
  1433. jpegls_encoder_select="golomb"
  1434. jv_decoder_select="dsputil"
  1435. lagarith_decoder_select="dsputil"
  1436. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1437. loco_decoder_select="golomb"
  1438. mdec_decoder_select="dsputil error_resilience mpegvideo"
  1439. mimic_decoder_select="dsputil hpeldsp"
  1440. mjpeg_decoder_select="dsputil hpeldsp"
  1441. mjpegb_decoder_select="dsputil hpeldsp"
  1442. mjpeg_encoder_select="aandcttables dsputil mpegvideoenc"
  1443. mlp_decoder_select="dsputil mlp_parser"
  1444. motionpixels_decoder_select="dsputil"
  1445. mp1_decoder_select="mpegaudio"
  1446. mp1float_decoder_select="mpegaudio"
  1447. mp2_decoder_select="mpegaudio"
  1448. mp2float_decoder_select="mpegaudio"
  1449. mp3_decoder_select="mpegaudio"
  1450. mp3adu_decoder_select="mpegaudio"
  1451. mp3adufloat_decoder_select="mpegaudio"
  1452. mp3float_decoder_select="mpegaudio"
  1453. mp3on4_decoder_select="mpegaudio"
  1454. mp3on4float_decoder_select="mpegaudio"
  1455. mpc7_decoder_select="dsputil mpegaudiodsp"
  1456. mpc8_decoder_select="dsputil mpegaudiodsp"
  1457. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1458. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1459. mpeg1video_decoder_select="error_resilience mpegvideo"
  1460. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1461. mpeg2video_decoder_select="error_resilience mpegvideo"
  1462. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1463. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1464. mpeg4_encoder_select="h263_encoder"
  1465. msmpeg4v1_decoder_select="h263_decoder"
  1466. msmpeg4v2_decoder_select="h263_decoder"
  1467. msmpeg4v2_encoder_select="h263_encoder"
  1468. msmpeg4v3_decoder_select="h263_decoder"
  1469. msmpeg4v3_encoder_select="h263_encoder"
  1470. mss2_decoder_select="error_resilience vc1_decoder"
  1471. mxpeg_decoder_select="dsputil hpeldsp"
  1472. nellymoser_decoder_select="mdct sinewin"
  1473. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1474. nuv_decoder_select="dsputil lzo"
  1475. png_decoder_select="dsputil zlib"
  1476. png_encoder_select="dsputil zlib"
  1477. prores_decoder_select="dsputil"
  1478. prores_encoder_select="dsputil"
  1479. qcelp_decoder_select="lsp"
  1480. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1481. ra_144_encoder_select="audio_frame_queue lpc"
  1482. ralf_decoder_select="golomb"
  1483. rv10_decoder_select="error_resilience h263_decoder"
  1484. rv10_encoder_select="h263_encoder"
  1485. rv20_decoder_select="error_resilience h263_decoder"
  1486. rv20_encoder_select="h263_encoder"
  1487. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1488. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1489. shorten_decoder_select="golomb"
  1490. sipr_decoder_select="lsp"
  1491. sp5x_decoder_select="dsputil hpeldsp"
  1492. svq1_decoder_select="hpeldsp"
  1493. svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
  1494. svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel hpeldsp mpegvideo videodsp"
  1495. svq3_decoder_suggest="error_resilience zlib"
  1496. tak_decoder_select="dsputil"
  1497. theora_decoder_select="vp3_decoder"
  1498. tiff_decoder_suggest="zlib"
  1499. tiff_encoder_suggest="zlib"
  1500. thp_decoder_select="dsputil hpeldsp"
  1501. truehd_decoder_select="mlp_decoder"
  1502. truemotion2_decoder_select="dsputil"
  1503. truespeech_decoder_select="dsputil"
  1504. tscc_decoder_select="zlib"
  1505. twinvq_decoder_select="mdct lsp sinewin"
  1506. utvideo_decoder_select="dsputil"
  1507. utvideo_encoder_select="dsputil huffman"
  1508. vble_decoder_select="dsputil"
  1509. vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel"
  1510. vc1image_decoder_select="vc1_decoder"
  1511. vorbis_decoder_select="mdct"
  1512. vorbis_encoder_select="mdct"
  1513. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1514. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  1515. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  1516. vp6a_decoder_select="vp6_decoder"
  1517. vp6f_decoder_select="vp6_decoder"
  1518. vp8_decoder_select="h264pred videodsp"
  1519. wmapro_decoder_select="mdct sinewin"
  1520. wmav1_decoder_select="mdct sinewin"
  1521. wmav1_encoder_select="mdct sinewin"
  1522. wmav2_decoder_select="mdct sinewin"
  1523. wmav2_encoder_select="mdct sinewin"
  1524. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1525. wmv1_decoder_select="h263_decoder"
  1526. wmv1_encoder_select="h263_encoder"
  1527. wmv2_decoder_select="h263_decoder videodsp"
  1528. wmv2_encoder_select="h263_encoder"
  1529. wmv3_decoder_select="vc1_decoder"
  1530. wmv3image_decoder_select="wmv3_decoder"
  1531. zerocodec_decoder_select="zlib"
  1532. zlib_decoder_select="zlib"
  1533. zlib_encoder_select="zlib"
  1534. zmbv_decoder_select="zlib"
  1535. zmbv_encoder_select="zlib"
  1536. # hardware accelerators
  1537. dxva2_deps="dxva2api_h"
  1538. vaapi_deps="va_va_h"
  1539. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1540. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1541. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1542. h263_vaapi_hwaccel_deps="vaapi"
  1543. h263_vaapi_hwaccel_select="h263_decoder"
  1544. h263_vdpau_hwaccel_deps="vdpau"
  1545. h263_vdpau_hwaccel_select="h263_decoder"
  1546. h264_dxva2_hwaccel_deps="dxva2"
  1547. h264_dxva2_hwaccel_select="h264_decoder"
  1548. h264_vaapi_hwaccel_deps="vaapi"
  1549. h264_vaapi_hwaccel_select="h264_decoder"
  1550. h264_vda_hwaccel_deps="vda"
  1551. h264_vda_hwaccel_select="h264_decoder"
  1552. h264_vdpau_decoder_deps="vdpau"
  1553. h264_vdpau_decoder_select="h264_decoder"
  1554. h264_vdpau_hwaccel_deps="vdpau"
  1555. h264_vdpau_hwaccel_select="h264_decoder"
  1556. mpeg_vdpau_decoder_deps="vdpau"
  1557. mpeg_vdpau_decoder_select="mpeg2video_decoder"
  1558. mpeg1_vdpau_decoder_deps="vdpau"
  1559. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  1560. mpeg1_vdpau_hwaccel_deps="vdpau"
  1561. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  1562. mpeg2_dxva2_hwaccel_deps="dxva2"
  1563. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  1564. mpeg2_vaapi_hwaccel_deps="vaapi"
  1565. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  1566. mpeg2_vdpau_hwaccel_deps="vdpau"
  1567. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  1568. mpeg4_vaapi_hwaccel_deps="vaapi"
  1569. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  1570. mpeg4_vdpau_decoder_deps="vdpau"
  1571. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  1572. mpeg4_vdpau_hwaccel_deps="vdpau"
  1573. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  1574. vc1_dxva2_hwaccel_deps="dxva2"
  1575. vc1_dxva2_hwaccel_select="vc1_decoder"
  1576. vc1_vaapi_hwaccel_deps="vaapi"
  1577. vc1_vaapi_hwaccel_select="vc1_decoder"
  1578. vc1_vdpau_decoder_deps="vdpau"
  1579. vc1_vdpau_decoder_select="vc1_decoder"
  1580. vc1_vdpau_hwaccel_deps="vdpau"
  1581. vc1_vdpau_hwaccel_select="vc1_decoder"
  1582. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1583. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1584. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1585. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1586. # parsers
  1587. h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1588. mpeg4video_parser_select="error_resilience mpegvideo"
  1589. mpegvideo_parser_select="error_resilience mpegvideo"
  1590. vc1_parser_select="mpegvideo"
  1591. # external libraries
  1592. libfaac_encoder_deps="libfaac"
  1593. libfaac_encoder_select="audio_frame_queue"
  1594. libfdk_aac_encoder_deps="libfdk_aac"
  1595. libfdk_aac_encoder_select="audio_frame_queue"
  1596. libgsm_decoder_deps="libgsm"
  1597. libgsm_encoder_deps="libgsm"
  1598. libgsm_ms_decoder_deps="libgsm"
  1599. libgsm_ms_encoder_deps="libgsm"
  1600. libilbc_decoder_deps="libilbc"
  1601. libilbc_encoder_deps="libilbc"
  1602. libmp3lame_encoder_deps="libmp3lame"
  1603. libmp3lame_encoder_select="audio_frame_queue"
  1604. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1605. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1606. libopencore_amrnb_encoder_select="audio_frame_queue"
  1607. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1608. libopenjpeg_decoder_deps="libopenjpeg"
  1609. libopenjpeg_encoder_deps="libopenjpeg"
  1610. libopus_decoder_deps="libopus"
  1611. libopus_encoder_deps="libopus"
  1612. libopus_encoder_select="audio_frame_queue"
  1613. libschroedinger_decoder_deps="libschroedinger"
  1614. libschroedinger_encoder_deps="libschroedinger"
  1615. libspeex_decoder_deps="libspeex"
  1616. libspeex_encoder_deps="libspeex"
  1617. libspeex_encoder_select="audio_frame_queue"
  1618. libtheora_encoder_deps="libtheora"
  1619. libvo_aacenc_encoder_deps="libvo_aacenc"
  1620. libvo_aacenc_encoder_select="audio_frame_queue"
  1621. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1622. libvorbis_encoder_deps="libvorbis"
  1623. libvorbis_encoder_select="audio_frame_queue"
  1624. libvpx_vp8_decoder_deps="libvpx"
  1625. libvpx_vp8_encoder_deps="libvpx"
  1626. libvpx_vp9_decoder_deps="libvpx"
  1627. libvpx_vp9_encoder_deps="libvpx"
  1628. libx264_encoder_deps="libx264"
  1629. libxavs_encoder_deps="libxavs"
  1630. libxvid_encoder_deps="libxvid"
  1631. # demuxers / muxers
  1632. ac3_demuxer_select="ac3_parser"
  1633. asf_stream_muxer_select="asf_muxer"
  1634. avisynth_demuxer_deps="avisynth"
  1635. dirac_demuxer_select="dirac_parser"
  1636. eac3_demuxer_select="ac3_parser"
  1637. flac_demuxer_select="flac_parser"
  1638. ipod_muxer_select="mov_muxer"
  1639. ismv_muxer_select="mov_muxer"
  1640. matroska_audio_muxer_select="matroska_muxer"
  1641. matroska_demuxer_suggest="bzlib lzo zlib"
  1642. mov_demuxer_suggest="zlib"
  1643. mov_muxer_select="rtpenc_chain"
  1644. mp3_demuxer_select="mpegaudio_parser"
  1645. mp4_muxer_select="mov_muxer"
  1646. mpegts_muxer_select="adts_muxer latm_muxer"
  1647. mpegtsraw_demuxer_select="mpegts_demuxer"
  1648. mxf_d10_muxer_select="mxf_muxer"
  1649. ogg_demuxer_select="golomb"
  1650. psp_muxer_select="mov_muxer"
  1651. rtp_demuxer_select="sdp_demuxer"
  1652. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1653. rtsp_demuxer_select="http_protocol rtpdec"
  1654. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1655. sap_demuxer_select="sdp_demuxer"
  1656. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1657. sdp_demuxer_select="rtpdec"
  1658. smoothstreaming_muxer_select="ismv_muxer"
  1659. spdif_muxer_select="aac_parser"
  1660. tak_demuxer_select="tak_parser"
  1661. tg2_muxer_select="mov_muxer"
  1662. tgp_muxer_select="mov_muxer"
  1663. w64_demuxer_deps="wav_demuxer"
  1664. # indevs / outdevs
  1665. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1666. alsa_outdev_deps="alsa_asoundlib_h"
  1667. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1668. dv1394_indev_deps="dv1394 dv_demuxer"
  1669. fbdev_indev_deps="linux_fb_h"
  1670. jack_indev_deps="jack_jack_h pthreads"
  1671. libcdio_indev_deps="libcdio"
  1672. libdc1394_indev_deps="libdc1394"
  1673. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1674. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1675. pulse_indev_deps="libpulse"
  1676. sndio_indev_deps="sndio_h"
  1677. sndio_outdev_deps="sndio_h"
  1678. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1679. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1680. vfwcap_indev_extralibs="-lavicap32"
  1681. x11grab_indev_deps="x11grab XShmCreateImage"
  1682. # protocols
  1683. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1684. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1685. ffrtmpcrypt_protocol_select="tcp_protocol"
  1686. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1687. ffrtmphttp_protocol_select="http_protocol"
  1688. gopher_protocol_select="network"
  1689. httpproxy_protocol_select="tcp_protocol"
  1690. http_protocol_select="tcp_protocol"
  1691. https_protocol_select="tls_protocol"
  1692. librtmp_protocol_deps="librtmp"
  1693. librtmpe_protocol_deps="librtmp"
  1694. librtmps_protocol_deps="librtmp"
  1695. librtmpt_protocol_deps="librtmp"
  1696. librtmpte_protocol_deps="librtmp"
  1697. mmsh_protocol_select="http_protocol"
  1698. mmst_protocol_select="network"
  1699. rtmp_protocol_deps="!librtmp_protocol"
  1700. rtmp_protocol_select="tcp_protocol"
  1701. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1702. rtmps_protocol_deps="!librtmp_protocol"
  1703. rtmps_protocol_select="tls_protocol"
  1704. rtmpt_protocol_select="ffrtmphttp_protocol"
  1705. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1706. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1707. rtp_protocol_select="udp_protocol"
  1708. sctp_protocol_deps="struct_sctp_event_subscribe"
  1709. sctp_protocol_select="network"
  1710. srtp_protocol_select="rtp_protocol"
  1711. tcp_protocol_select="network"
  1712. tls_protocol_deps_any="openssl gnutls"
  1713. tls_protocol_select="tcp_protocol"
  1714. udp_protocol_select="network"
  1715. # filters
  1716. blackframe_filter_deps="gpl"
  1717. boxblur_filter_deps="gpl"
  1718. cropdetect_filter_deps="gpl"
  1719. delogo_filter_deps="gpl"
  1720. drawtext_filter_deps="libfreetype"
  1721. frei0r_filter_deps="frei0r dlopen strtok_r"
  1722. frei0r_filter_extralibs='$ldl'
  1723. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1724. frei0r_src_filter_extralibs='$ldl'
  1725. hqdn3d_filter_deps="gpl"
  1726. interlace_filter_deps="gpl"
  1727. resample_filter_deps="avresample"
  1728. ocv_filter_deps="libopencv"
  1729. scale_filter_deps="swscale"
  1730. yadif_filter_deps="gpl"
  1731. # libraries
  1732. avcodec_deps="avutil"
  1733. avdevice_deps="avutil avcodec avformat"
  1734. avfilter_deps="avutil"
  1735. avformat_deps="avutil avcodec"
  1736. avresample_deps="avutil"
  1737. swscale_deps="avutil"
  1738. # programs
  1739. avconv_deps="avcodec avfilter avformat avresample swscale"
  1740. avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
  1741. fps_filter null_filter resample_filter scale_filter
  1742. setpts_filter trim_filter"
  1743. avplay_deps="avcodec avformat avresample swscale sdl"
  1744. avplay_select="rdft"
  1745. avprobe_deps="avcodec avformat"
  1746. avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
  1747. avserver_extralibs='$ldl'
  1748. doc_deps="texi2html"
  1749. # default parameters
  1750. logfile="config.log"
  1751. # installation paths
  1752. prefix_default="/usr/local"
  1753. bindir_default='${prefix}/bin'
  1754. datadir_default='${prefix}/share/avconv'
  1755. incdir_default='${prefix}/include'
  1756. libdir_default='${prefix}/lib'
  1757. mandir_default='${prefix}/share/man'
  1758. shlibdir_default="$libdir_default"
  1759. # toolchain
  1760. ar_default="ar"
  1761. cc_default="gcc"
  1762. host_cc_default="gcc"
  1763. cp_f="cp -f"
  1764. ln_s="ln -s -f"
  1765. nm_default="nm -g"
  1766. objformat="elf"
  1767. pkg_config_default=pkg-config
  1768. ranlib="ranlib"
  1769. yasmexe="yasm"
  1770. nogas=":"
  1771. # machine
  1772. arch_default=$(uname -m)
  1773. cpu="generic"
  1774. # OS
  1775. target_os_default=$(tolower $(uname -s))
  1776. host_os=$target_os_default
  1777. # configurable options
  1778. enable $LIBRARY_LIST $PROGRAM_LIST
  1779. enable asm
  1780. enable debug
  1781. enable doc
  1782. enable optimizations
  1783. enable safe_bitstream_reader
  1784. enable static
  1785. enable swscale_alpha
  1786. # By default, enable only those hwaccels that have no external dependencies.
  1787. enable dxva2 vdpau
  1788. # build settings
  1789. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1790. AVSERVERLDFLAGS=-Wl,-E
  1791. LIBPREF="lib"
  1792. LIBSUF=".a"
  1793. FULLNAME='$(NAME)$(BUILDSUF)'
  1794. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1795. SLIBPREF="lib"
  1796. SLIBSUF=".so"
  1797. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1798. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1799. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1800. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1801. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1802. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1803. asflags_filter=echo
  1804. cflags_filter=echo
  1805. ldflags_filter=echo
  1806. AS_C='-c'
  1807. AS_O='-o $@'
  1808. CC_C='-c'
  1809. CC_E='-E -o $@'
  1810. CC_O='-o $@'
  1811. LD_O='-o $@'
  1812. LD_LIB='-l%'
  1813. LD_PATH='-L'
  1814. HOSTCC_C='-c'
  1815. HOSTCC_O='-o $@'
  1816. HOSTLD_O='-o $@'
  1817. host_cflags='-O3 -g'
  1818. host_cppflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600'
  1819. host_libs='-lm'
  1820. host_cflags_filter=echo
  1821. host_ldflags_filter=echo
  1822. target_path='$(CURDIR)'
  1823. # since the object filename is not given with the -MM flag, the compiler
  1824. # is only able to print the basename, and we must add the path ourselves
  1825. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1826. DEPFLAGS='-MM'
  1827. # find source path
  1828. if test -f configure; then
  1829. source_path=.
  1830. else
  1831. source_path=$(cd $(dirname "$0"); pwd)
  1832. echo "$source_path" | grep -q '[[:blank:]]' &&
  1833. die "Out of tree builds are impossible with whitespace in source path."
  1834. test -e "$source_path/config.h" &&
  1835. die "Out of tree builds are impossible with config.h in source dir."
  1836. fi
  1837. for v in "$@"; do
  1838. r=${v#*=}
  1839. l=${v%"$r"}
  1840. r=$(sh_quote "$r")
  1841. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  1842. done
  1843. find_things(){
  1844. thing=$1
  1845. pattern=$2
  1846. file=$source_path/$3
  1847. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1848. }
  1849. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1850. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1851. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1852. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1853. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1854. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1855. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1856. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1857. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1858. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1859. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1860. ALL_COMPONENTS="
  1861. $BSF_LIST
  1862. $DECODER_LIST
  1863. $DEMUXER_LIST
  1864. $ENCODER_LIST
  1865. $FILTER_LIST
  1866. $HWACCEL_LIST
  1867. $INDEV_LIST
  1868. $MUXER_LIST
  1869. $OUTDEV_LIST
  1870. $PARSER_LIST
  1871. $PROTOCOL_LIST
  1872. "
  1873. for n in $COMPONENT_LIST; do
  1874. v=$(toupper ${n%s})_LIST
  1875. eval enable \$$v
  1876. eval ${n}_if_any="\$$v"
  1877. done
  1878. enable $ARCH_EXT_LIST
  1879. die_unknown(){
  1880. echo "Unknown option \"$1\"."
  1881. echo "See $0 --help for available options."
  1882. exit 1
  1883. }
  1884. print_3_columns() {
  1885. cat | tr ' ' '\n' | sort | pr -r -3 -t
  1886. }
  1887. show_list() {
  1888. suffix=_$1
  1889. shift
  1890. echo $* | sed s/$suffix//g | print_3_columns
  1891. exit 0
  1892. }
  1893. rand_list(){
  1894. IFS=', '
  1895. set -- $*
  1896. unset IFS
  1897. for thing; do
  1898. comp=${thing%:*}
  1899. prob=${thing#$comp}
  1900. prob=${prob#:}
  1901. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  1902. echo "prob ${prob:-0.5}"
  1903. printf '%s\n' $comp
  1904. done
  1905. }
  1906. do_random(){
  1907. action=$1
  1908. shift
  1909. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  1910. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  1911. }
  1912. for opt do
  1913. optval="${opt#*=}"
  1914. case "$opt" in
  1915. --extra-ldflags=*)
  1916. add_ldflags $optval
  1917. ;;
  1918. --extra-libs=*)
  1919. add_extralibs $optval
  1920. ;;
  1921. --disable-devices)
  1922. disable $INDEV_LIST $OUTDEV_LIST
  1923. ;;
  1924. --enable-debug=*)
  1925. debuglevel="$optval"
  1926. ;;
  1927. --disable-programs)
  1928. disable $PROGRAM_LIST
  1929. ;;
  1930. --disable-everything)
  1931. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1932. ;;
  1933. --disable-all)
  1934. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1935. disable $LIBRARY_LIST $PROGRAM_LIST doc
  1936. ;;
  1937. --enable-random|--disable-random)
  1938. action=${opt%%-random}
  1939. do_random ${action#--} $COMPONENT_LIST
  1940. ;;
  1941. --enable-random=*|--disable-random=*)
  1942. action=${opt%%-random=*}
  1943. do_random ${action#--} $optval
  1944. ;;
  1945. --enable-*=*|--disable-*=*)
  1946. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1947. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1948. eval list=\$$(toupper $thing)_LIST
  1949. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1950. $action $(filter "$name" $list)
  1951. ;;
  1952. --enable-?*|--disable-?*)
  1953. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1954. if is_in $option $COMPONENT_LIST; then
  1955. test $action = disable && action=unset
  1956. eval $action \$$(toupper ${option%s})_LIST
  1957. elif is_in $option $CMDLINE_SELECT; then
  1958. $action $option
  1959. else
  1960. die_unknown $opt
  1961. fi
  1962. ;;
  1963. --list-*)
  1964. NAME="${opt#--list-}"
  1965. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1966. NAME=${NAME%s}
  1967. eval show_list $NAME \$$(toupper $NAME)_LIST
  1968. ;;
  1969. --help|-h) show_help
  1970. ;;
  1971. *)
  1972. optname="${opt%%=*}"
  1973. optname="${optname#--}"
  1974. optname=$(echo "$optname" | sed 's/-/_/g')
  1975. if is_in $optname $CMDLINE_SET; then
  1976. eval $optname='$optval'
  1977. elif is_in $optname $CMDLINE_APPEND; then
  1978. append $optname "$optval"
  1979. else
  1980. die_unknown $opt
  1981. fi
  1982. ;;
  1983. esac
  1984. done
  1985. disabled logging && logfile=/dev/null
  1986. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  1987. set >> $logfile
  1988. test -n "$cross_prefix" && enable cross_compile
  1989. if enabled cross_compile; then
  1990. test -n "$arch" && test -n "$target_os" ||
  1991. die "Must specify target arch and OS when cross-compiling"
  1992. fi
  1993. ar_default="${cross_prefix}${ar_default}"
  1994. cc_default="${cross_prefix}${cc_default}"
  1995. nm_default="${cross_prefix}${nm_default}"
  1996. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1997. ranlib="${cross_prefix}${ranlib}"
  1998. sysinclude_default="${sysroot}/usr/include"
  1999. case "$toolchain" in
  2000. clang-asan)
  2001. cc_default="clang"
  2002. add_cflags -fsanitize=address
  2003. add_ldflags -fsanitize=address
  2004. ;;
  2005. clang-tsan)
  2006. cc_default="clang"
  2007. add_cflags -fsanitize=thread -pie
  2008. add_ldflags -fsanitize=thread -pie
  2009. ;;
  2010. gcc-asan)
  2011. cc_default="gcc"
  2012. add_cflags -fsanitize=address
  2013. add_ldflags -fsanitize=address
  2014. ;;
  2015. gcc-tsan)
  2016. cc_default="gcc"
  2017. add_cflags -fsanitize=thread -pie -fPIC
  2018. add_ldflags -fsanitize=thread -pie -fPIC
  2019. ;;
  2020. valgrind-massif)
  2021. target_exec_default="valgrind"
  2022. target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
  2023. ;;
  2024. valgrind-memcheck)
  2025. target_exec_default="valgrind"
  2026. target_exec_args="--track-origins=yes --leak-check=full"
  2027. ;;
  2028. msvc)
  2029. cc_default="c99wrap cl"
  2030. ld_default="c99wrap link"
  2031. nm_default="dumpbin -symbols"
  2032. ar_default="lib"
  2033. target_os_default="win32"
  2034. ;;
  2035. icl)
  2036. cc_default="c99wrap -noconv icl"
  2037. ld_default="c99wrap xilink"
  2038. nm_default="dumpbin -symbols"
  2039. ar_default="xilib"
  2040. target_os_default="win32"
  2041. ;;
  2042. gcov)
  2043. add_cflags -fprofile-arcs -ftest-coverage
  2044. add_ldflags -fprofile-arcs -ftest-coverage
  2045. ;;
  2046. ?*)
  2047. die "Unknown toolchain $toolchain"
  2048. ;;
  2049. esac
  2050. set_default arch cc pkg_config sysinclude target_exec target_os
  2051. enabled cross_compile || host_cc_default=$cc
  2052. set_default host_cc
  2053. if ! $pkg_config --version >/dev/null 2>&1; then
  2054. warn "$pkg_config not found, library detection may fail."
  2055. pkg_config=false
  2056. fi
  2057. exesuf() {
  2058. case $1 in
  2059. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2060. esac
  2061. }
  2062. EXESUF=$(exesuf $target_os)
  2063. HOSTEXESUF=$(exesuf $host_os)
  2064. # set temporary file name
  2065. : ${TMPDIR:=$TEMPDIR}
  2066. : ${TMPDIR:=$TMP}
  2067. : ${TMPDIR:=/tmp}
  2068. if ! check_cmd mktemp -u XXXXXX; then
  2069. # simple replacement for missing mktemp
  2070. # NOT SAFE FOR GENERAL USE
  2071. mktemp(){
  2072. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2073. }
  2074. fi
  2075. tmpfile(){
  2076. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2077. (set -C; exec > $tmp) 2>/dev/null ||
  2078. die "Unable to create temporary file in $TMPDIR."
  2079. append TMPFILES $tmp
  2080. eval $1=$tmp
  2081. }
  2082. trap 'rm -f -- $TMPFILES' EXIT
  2083. tmpfile TMPASM .asm
  2084. tmpfile TMPC .c
  2085. tmpfile TMPE $EXESUF
  2086. tmpfile TMPH .h
  2087. tmpfile TMPO .o
  2088. tmpfile TMPS .S
  2089. tmpfile TMPSH .sh
  2090. tmpfile TMPV .ver
  2091. unset -f mktemp
  2092. chmod +x $TMPE
  2093. # make sure we can execute files in $TMPDIR
  2094. cat > $TMPSH 2>> $logfile <<EOF
  2095. #! /bin/sh
  2096. EOF
  2097. chmod +x $TMPSH >> $logfile 2>&1
  2098. if ! $TMPSH >> $logfile 2>&1; then
  2099. cat <<EOF
  2100. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2101. variable to another directory and make sure that it is not mounted noexec.
  2102. EOF
  2103. die "Sanity test failed."
  2104. fi
  2105. ccc_flags(){
  2106. for flag; do
  2107. case $flag in
  2108. -std=c99) echo -c99 ;;
  2109. -mcpu=*) echo -arch ${flag#*=} ;;
  2110. -mieee) echo -ieee ;;
  2111. -O*|-fast) echo $flag ;;
  2112. -fno-math-errno) echo -assume nomath_errno ;;
  2113. -g) echo -g3 ;;
  2114. -Wall) echo -msg_enable level2 ;;
  2115. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2116. -Wl,*) echo $flag ;;
  2117. -f*|-W*) ;;
  2118. *) echo $flag ;;
  2119. esac
  2120. done
  2121. }
  2122. msvc_common_flags(){
  2123. for flag; do
  2124. case $flag in
  2125. # In addition to specifying certain flags under the compiler
  2126. # specific filters, they must be specified here as well or else the
  2127. # generic catch all at the bottom will print the original flag.
  2128. -Wall) ;;
  2129. -std=c99) ;;
  2130. # Common flags
  2131. -fomit-frame-pointer) echo -Oy ;;
  2132. -g) echo -Z7 ;;
  2133. -fno-math-errno) ;;
  2134. -fno-common) ;;
  2135. -fno-signed-zeros) ;;
  2136. -fPIC) ;;
  2137. -mthumb) ;;
  2138. -march=*) ;;
  2139. -lz) echo zlib.lib ;;
  2140. -lavifil32) echo vfw32.lib ;;
  2141. -lavicap32) echo vfw32.lib user32.lib ;;
  2142. -l*) echo ${flag#-l}.lib ;;
  2143. *) echo $flag ;;
  2144. esac
  2145. done
  2146. }
  2147. msvc_flags(){
  2148. msvc_common_flags "$@"
  2149. for flag; do
  2150. case $flag in
  2151. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2152. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2153. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2154. -wd4996 -wd4273 ;;
  2155. esac
  2156. done
  2157. }
  2158. icl_flags(){
  2159. msvc_common_flags "$@"
  2160. for flag; do
  2161. case $flag in
  2162. # Despite what Intel's documentation says -Wall, which is supported
  2163. # on Windows, does enable remarks so disable them here.
  2164. -Wall) echo $flag -Qdiag-disable:remark ;;
  2165. -std=c99) echo -Qstd=c99 ;;
  2166. esac
  2167. done
  2168. }
  2169. pgi_flags(){
  2170. for flag; do
  2171. case $flag in
  2172. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2173. -fomit-frame-pointer) echo -Mnoframe ;;
  2174. -g) echo -gopt ;;
  2175. *) echo $flag ;;
  2176. esac
  2177. done
  2178. }
  2179. suncc_flags(){
  2180. for flag; do
  2181. case $flag in
  2182. -march=*|-mcpu=*)
  2183. case "${flag#*=}" in
  2184. native) echo -xtarget=native ;;
  2185. v9|niagara) echo -xarch=sparc ;;
  2186. ultrasparc) echo -xarch=sparcvis ;;
  2187. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2188. i586|pentium) echo -xchip=pentium ;;
  2189. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2190. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2191. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2192. pentium4*) echo -xtarget=pentium4 ;;
  2193. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2194. *-sse3) echo -xarch=sse3 ;;
  2195. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2196. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2197. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2198. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2199. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2200. k8|opteron|athlon64|athlon-fx)
  2201. echo -xarch=sse2a ;;
  2202. athlon*) echo -xarch=pentium_proa ;;
  2203. esac
  2204. ;;
  2205. -std=c99) echo -xc99 ;;
  2206. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2207. -fPIC) echo -KPIC -xcode=pic32 ;;
  2208. -W*,*) echo $flag ;;
  2209. -f*-*|-W*|-mimpure-text) ;;
  2210. -shared) echo -G ;;
  2211. *) echo $flag ;;
  2212. esac
  2213. done
  2214. }
  2215. tms470_flags(){
  2216. for flag; do
  2217. case $flag in
  2218. -march=*|-mcpu=*)
  2219. case "${flag#*=}" in
  2220. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2221. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2222. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2223. armv6*|arm11*) echo -mv=6 ;;
  2224. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2225. echo -mv=5e ;;
  2226. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2227. esac
  2228. ;;
  2229. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2230. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2231. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2232. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2233. -msoft-float) echo --float_support=vfplib ;;
  2234. -O[0-3]|-mf=*) echo $flag ;;
  2235. -g) echo -g -mn ;;
  2236. -pds=*) echo $flag ;;
  2237. -D*|-I*) echo $flag ;;
  2238. --gcc|--abi=*) echo $flag ;;
  2239. -me) echo $flag ;;
  2240. esac
  2241. done
  2242. }
  2243. probe_cc(){
  2244. pfx=$1
  2245. _cc=$2
  2246. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2247. unset _ld_o _ldflags _ld_lib _ld_path
  2248. unset _depflags _DEPCMD _DEPFLAGS
  2249. _flags_filter=echo
  2250. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2251. _type=llvm_gcc
  2252. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2253. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2254. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2255. _cflags_speed='-O3'
  2256. _cflags_size='-Os'
  2257. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2258. _type=gcc
  2259. gcc_version=$($_cc --version | head -n1)
  2260. gcc_basever=$($_cc -dumpversion)
  2261. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2262. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2263. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2264. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2265. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2266. fi
  2267. _cflags_speed='-O3'
  2268. _cflags_size='-Os'
  2269. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2270. _type=icc
  2271. _ident=$($_cc --version | head -n1)
  2272. _depflags='-MMD'
  2273. _cflags_speed='-O3'
  2274. _cflags_size='-Os'
  2275. _cflags_noopt='-O1'
  2276. elif $_cc -v 2>&1 | grep -q xlc; then
  2277. _type=xlc
  2278. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2279. _cflags_speed='-O5'
  2280. _cflags_size='-O5 -qcompact'
  2281. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2282. _type=ccc
  2283. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2284. _DEPFLAGS='-M'
  2285. _cflags_speed='-fast'
  2286. _cflags_size='-O1'
  2287. _flags_filter=ccc_flags
  2288. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2289. test -d "$sysroot" || die "No valid sysroot specified."
  2290. _type=armcc
  2291. _ident=$($_cc --vsn | head -n1)
  2292. armcc_conf="$PWD/armcc.conf"
  2293. $_cc --arm_linux_configure \
  2294. --arm_linux_config_file="$armcc_conf" \
  2295. --configure_sysroot="$sysroot" \
  2296. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2297. die "Error creating armcc configuration file."
  2298. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2299. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2300. as_default="${cross_prefix}gcc"
  2301. _depflags='-MMD'
  2302. _cflags_speed='-O3'
  2303. _cflags_size='-Os'
  2304. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2305. _type=tms470
  2306. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2307. _flags='--gcc --abi=eabi -me'
  2308. _cc_e='-ppl -fe=$@'
  2309. _cc_o='-fe=$@'
  2310. _depflags='-ppa -ppd=$(@:.o=.d)'
  2311. _cflags_speed='-O3 -mf=5'
  2312. _cflags_size='-O3 -mf=2'
  2313. _flags_filter=tms470_flags
  2314. elif $_cc -v 2>&1 | grep -q clang; then
  2315. _type=clang
  2316. _ident=$($_cc --version | head -n1)
  2317. _depflags='-MMD'
  2318. _cflags_speed='-O3'
  2319. _cflags_size='-Os'
  2320. elif $_cc -V 2>&1 | grep -q Sun; then
  2321. _type=suncc
  2322. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2323. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2324. _DEPFLAGS='-xM1 -xc99'
  2325. _ldflags='-std=c99'
  2326. _cflags_speed='-O5'
  2327. _cflags_size='-O5 -xspace'
  2328. _flags_filter=suncc_flags
  2329. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2330. _type=pathscale
  2331. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2332. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2333. _cflags_speed='-O2'
  2334. _cflags_size='-Os'
  2335. _flags_filter='filter_out -Wdisabled-optimization'
  2336. elif $_cc -v 2>&1 | grep -q Open64; then
  2337. _type=open64
  2338. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2339. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2340. _cflags_speed='-O2'
  2341. _cflags_size='-Os'
  2342. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2343. elif $_cc -V 2>&1 | grep -q Portland; then
  2344. _type=pgi
  2345. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2346. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2347. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2348. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2349. _cflags_noopt="-O1"
  2350. _flags_filter=pgi_flags
  2351. elif $_cc 2>&1 | grep -q Microsoft; then
  2352. _type=msvc
  2353. _ident=$($cc 2>&1 | head -n1)
  2354. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2355. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2356. _cflags_speed="-O2"
  2357. _cflags_size="-O1"
  2358. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2359. if $_cc 2>&1 | grep -q Linker; then
  2360. _ld_o='-out $@'
  2361. else
  2362. _ld_o='-Fe$@'
  2363. fi
  2364. _cc_o='-Fo $@'
  2365. _cc_e='-P -Fi $@'
  2366. _flags_filter=msvc_flags
  2367. _ld_lib='lib%.a'
  2368. _ld_path='-libpath:'
  2369. _flags='-nologo'
  2370. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2371. if [ $pfx = hostcc ]; then
  2372. append _cflags -Dsnprintf=_snprintf
  2373. fi
  2374. elif $_cc 2>&1 | grep -q Intel; then
  2375. _type=icl
  2376. _ident=$($cc 2>&1 | head -n1)
  2377. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2378. # Not only is O3 broken on 13.x+ but it's slower on all previous versions (tested) as well
  2379. _cflags_speed="-O2"
  2380. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2381. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2382. if $_cc 2>&1 | grep -q Linker; then
  2383. _ld_o='-out $@'
  2384. else
  2385. _ld_o='-Fe$@'
  2386. fi
  2387. _cc_o='-Fo $@'
  2388. _cc_e='-P'
  2389. _flags_filter=icl_flags
  2390. _ld_lib='lib%.a'
  2391. _ld_path='-libpath:'
  2392. # -Qdiag-error to make icl error when presented with certain unknown arguments
  2393. _flags='-nologo -Qdiag-error:4044,10157'
  2394. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with msvc which enables it by default
  2395. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2396. if [ $pfx = hostcc ]; then
  2397. append _cflags -Dsnprintf=_snprintf
  2398. fi
  2399. fi
  2400. eval ${pfx}_type=\$_type
  2401. eval ${pfx}_ident=\$_ident
  2402. }
  2403. set_ccvars(){
  2404. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2405. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2406. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2407. if [ -n "$_depflags" ]; then
  2408. eval ${1}_DEPFLAGS=\$_depflags
  2409. else
  2410. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2411. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2412. eval DEP${1}FLAGS=\$_flags
  2413. fi
  2414. }
  2415. probe_cc cc "$cc"
  2416. cflags_filter=$_flags_filter
  2417. cflags_speed=$_cflags_speed
  2418. cflags_size=$_cflags_size
  2419. cflags_noopt=$_cflags_noopt
  2420. add_cflags $_flags $_cflags
  2421. cc_ldflags=$_ldflags
  2422. set_ccvars CC
  2423. probe_cc hostcc "$host_cc"
  2424. host_cflags_filter=$_flags_filter
  2425. add_host_cflags $_flags $_cflags
  2426. set_ccvars HOSTCC
  2427. test -n "$cc_type" && enable $cc_type ||
  2428. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2429. : ${as_default:=$cc}
  2430. : ${dep_cc_default:=$cc}
  2431. : ${ld_default:=$cc}
  2432. : ${host_ld_default:=$host_cc}
  2433. set_default ar as dep_cc ld host_ld
  2434. probe_cc as "$as"
  2435. asflags_filter=$_flags_filter
  2436. add_asflags $_flags $_cflags
  2437. set_ccvars AS
  2438. probe_cc ld "$ld"
  2439. ldflags_filter=$_flags_filter
  2440. add_ldflags $_flags $_ldflags
  2441. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2442. LD_O=${_ld_o-$LD_O}
  2443. LD_LIB=${_ld_lib-$LD_LIB}
  2444. LD_PATH=${_ld_path-$LD_PATH}
  2445. probe_cc hostld "$host_ld"
  2446. host_ldflags_filter=$_flags_filter
  2447. add_host_ldflags $_flags $_ldflags
  2448. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2449. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2450. probe_cc depcc "$dep_cc"
  2451. CCDEP=${_DEPCMD:-$DEPCMD}
  2452. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2453. DEPCCFLAGS=$_flags
  2454. fi
  2455. if $ar 2>&1 | grep -q Microsoft; then
  2456. arflags="-nologo"
  2457. ar_o='-out:$@'
  2458. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2459. arflags="rq"
  2460. ar_o='$@'
  2461. else
  2462. arflags="rc"
  2463. ar_o='$@'
  2464. fi
  2465. add_cflags $extra_cflags
  2466. add_asflags $extra_cflags
  2467. if test -n "$sysroot"; then
  2468. case "$cc_type" in
  2469. gcc|llvm_gcc|clang)
  2470. add_cppflags --sysroot="$sysroot"
  2471. add_ldflags --sysroot="$sysroot"
  2472. ;;
  2473. tms470)
  2474. add_cppflags -I"$sysinclude"
  2475. add_ldflags --sysroot="$sysroot"
  2476. ;;
  2477. esac
  2478. fi
  2479. if test "$cpu" = host; then
  2480. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2481. case "$cc_type" in
  2482. gcc|llvm_gcc)
  2483. check_native(){
  2484. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2485. sed -n "/cc1.*$1=/{
  2486. s/.*$1=\\([^ ]*\\).*/\\1/
  2487. p
  2488. q
  2489. }" $TMPE
  2490. }
  2491. cpu=$(check_native -march || check_native -mcpu)
  2492. ;;
  2493. esac
  2494. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2495. fi
  2496. # Deal with common $arch aliases
  2497. case "$arch" in
  2498. aarch64|arm64)
  2499. arch="aarch64"
  2500. ;;
  2501. arm*)
  2502. arch="arm"
  2503. ;;
  2504. mips*|IP*)
  2505. arch="mips"
  2506. ;;
  2507. parisc*|hppa*)
  2508. arch="parisc"
  2509. ;;
  2510. "Power Macintosh"|ppc*|powerpc*)
  2511. arch="ppc"
  2512. ;;
  2513. s390|s390x)
  2514. arch="s390"
  2515. ;;
  2516. sh4|sh)
  2517. arch="sh4"
  2518. ;;
  2519. sun4u|sparc*)
  2520. arch="sparc"
  2521. ;;
  2522. tilegx|tile-gx)
  2523. arch="tilegx"
  2524. ;;
  2525. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2526. arch="x86"
  2527. ;;
  2528. esac
  2529. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2530. enable $arch
  2531. # Add processor-specific flags
  2532. if enabled aarch64; then
  2533. case $cpu in
  2534. armv*)
  2535. cpuflags="-march=$cpu"
  2536. ;;
  2537. *)
  2538. cpuflags="-mcpu=$cpu"
  2539. ;;
  2540. esac
  2541. elif enabled alpha; then
  2542. cpuflags="-mcpu=$cpu"
  2543. elif enabled arm; then
  2544. check_arm_arch() {
  2545. check_cpp_condition stddef.h \
  2546. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2547. $cpuflags
  2548. }
  2549. probe_arm_arch() {
  2550. if check_arm_arch 4; then echo armv4;
  2551. elif check_arm_arch 4T; then echo armv4t;
  2552. elif check_arm_arch 5; then echo armv5;
  2553. elif check_arm_arch 5E; then echo armv5e;
  2554. elif check_arm_arch 5T; then echo armv5t;
  2555. elif check_arm_arch 5TE; then echo armv5te;
  2556. elif check_arm_arch 5TEJ; then echo armv5te;
  2557. elif check_arm_arch 6; then echo armv6;
  2558. elif check_arm_arch 6J; then echo armv6j;
  2559. elif check_arm_arch 6K; then echo armv6k;
  2560. elif check_arm_arch 6Z; then echo armv6z;
  2561. elif check_arm_arch 6ZK; then echo armv6zk;
  2562. elif check_arm_arch 6T2; then echo armv6t2;
  2563. elif check_arm_arch 7; then echo armv7;
  2564. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2565. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2566. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2567. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2568. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2569. fi
  2570. }
  2571. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2572. case $cpu in
  2573. armv*)
  2574. cpuflags="-march=$cpu"
  2575. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2576. ;;
  2577. *)
  2578. cpuflags="-mcpu=$cpu"
  2579. case $cpu in
  2580. cortex-a*) subarch=armv7a ;;
  2581. cortex-r*) subarch=armv7r ;;
  2582. cortex-m*) enable thumb; subarch=armv7m ;;
  2583. arm11*) subarch=armv6 ;;
  2584. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2585. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2586. *) subarch=$(probe_arm_arch) ;;
  2587. esac
  2588. ;;
  2589. esac
  2590. case "$subarch" in
  2591. armv5t*) enable fast_clz ;;
  2592. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2593. esac
  2594. elif enabled avr32; then
  2595. case $cpu in
  2596. ap7[02]0[0-2])
  2597. subarch="avr32_ap"
  2598. cpuflags="-mpart=$cpu"
  2599. ;;
  2600. ap)
  2601. subarch="avr32_ap"
  2602. cpuflags="-march=$cpu"
  2603. ;;
  2604. uc3[ab]*)
  2605. subarch="avr32_uc"
  2606. cpuflags="-mcpu=$cpu"
  2607. ;;
  2608. uc)
  2609. subarch="avr32_uc"
  2610. cpuflags="-march=$cpu"
  2611. ;;
  2612. esac
  2613. elif enabled bfin; then
  2614. cpuflags="-mcpu=$cpu"
  2615. elif enabled mips; then
  2616. cpuflags="-march=$cpu"
  2617. elif enabled ppc; then
  2618. case $(tolower $cpu) in
  2619. 601|ppc601|powerpc601)
  2620. cpuflags="-mcpu=601"
  2621. disable altivec
  2622. ;;
  2623. 603*|ppc603*|powerpc603*)
  2624. cpuflags="-mcpu=603"
  2625. disable altivec
  2626. ;;
  2627. 604*|ppc604*|powerpc604*)
  2628. cpuflags="-mcpu=604"
  2629. disable altivec
  2630. ;;
  2631. g3|75*|ppc75*|powerpc75*)
  2632. cpuflags="-mcpu=750"
  2633. disable altivec
  2634. ;;
  2635. g4|745*|ppc745*|powerpc745*)
  2636. cpuflags="-mcpu=7450"
  2637. ;;
  2638. 74*|ppc74*|powerpc74*)
  2639. cpuflags="-mcpu=7400"
  2640. ;;
  2641. g5|970|ppc970|powerpc970)
  2642. cpuflags="-mcpu=970"
  2643. ;;
  2644. power[3-7]*)
  2645. cpuflags="-mcpu=$cpu"
  2646. ;;
  2647. cell)
  2648. cpuflags="-mcpu=cell"
  2649. enable ldbrx
  2650. ;;
  2651. e500mc)
  2652. cpuflags="-mcpu=e500mc"
  2653. disable altivec
  2654. ;;
  2655. e500v2)
  2656. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2657. disable altivec
  2658. ;;
  2659. e500)
  2660. cpuflags="-mcpu=8540 -mhard-float"
  2661. disable altivec
  2662. ;;
  2663. esac
  2664. elif enabled sparc; then
  2665. case $cpu in
  2666. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  2667. cpuflags="-mcpu=$cpu"
  2668. disable vis
  2669. ;;
  2670. ultrasparc*|niagara[234])
  2671. cpuflags="-mcpu=$cpu"
  2672. ;;
  2673. esac
  2674. elif enabled x86; then
  2675. case $cpu in
  2676. i[345]86|pentium)
  2677. cpuflags="-march=$cpu"
  2678. disable mmx
  2679. ;;
  2680. # targets that do NOT support nopl and conditional mov (cmov)
  2681. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2682. cpuflags="-march=$cpu"
  2683. disable i686
  2684. ;;
  2685. # targets that do support nopl and conditional mov (cmov)
  2686. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
  2687. cpuflags="-march=$cpu"
  2688. enable i686
  2689. enable fast_cmov
  2690. ;;
  2691. # targets that do support conditional mov but on which it's slow
  2692. pentium4|pentium4m|prescott|nocona)
  2693. cpuflags="-march=$cpu"
  2694. enable i686
  2695. disable fast_cmov
  2696. ;;
  2697. esac
  2698. fi
  2699. if [ "$cpu" != generic ]; then
  2700. add_cflags $cpuflags
  2701. add_asflags $cpuflags
  2702. fi
  2703. # compiler sanity check
  2704. check_exec <<EOF
  2705. int main(void){ return 0; }
  2706. EOF
  2707. if test "$?" != 0; then
  2708. echo "$cc is unable to create an executable file."
  2709. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2710. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2711. echo "Only do this if you know what cross compiling means."
  2712. fi
  2713. die "C compiler test failed."
  2714. fi
  2715. add_cppflags -D_ISOC99_SOURCE
  2716. check_cflags -std=c99
  2717. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2718. #include <stdlib.h>
  2719. EOF
  2720. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2721. #include <stdlib.h>
  2722. EOF
  2723. check_host_cflags -std=c99
  2724. check_host_cflags -Wall
  2725. check_64bit(){
  2726. arch32=$1
  2727. arch64=$2
  2728. expr=$3
  2729. check_code cc "" "int test[2*($expr) - 1]" &&
  2730. subarch=$arch64 || subarch=$arch32
  2731. }
  2732. case "$arch" in
  2733. aarch64|alpha|ia64)
  2734. spic=$shared
  2735. ;;
  2736. mips)
  2737. check_64bit mips mips64 '_MIPS_SIM > 1'
  2738. spic=$shared
  2739. ;;
  2740. parisc)
  2741. check_64bit parisc parisc64 'sizeof(void *) > 4'
  2742. spic=$shared
  2743. ;;
  2744. ppc)
  2745. check_64bit ppc ppc64 'sizeof(void *) > 4'
  2746. spic=$shared
  2747. ;;
  2748. sparc)
  2749. check_64bit sparc sparc64 'sizeof(void *) > 4'
  2750. spic=$shared
  2751. ;;
  2752. x86)
  2753. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  2754. if test "$subarch" = "x86_64"; then
  2755. spic=$shared
  2756. fi
  2757. ;;
  2758. esac
  2759. enable $subarch
  2760. enabled spic && enable_weak pic
  2761. # OS specific
  2762. case $target_os in
  2763. haiku)
  2764. prefix_default="/boot/common"
  2765. network_extralibs="-lnetwork"
  2766. host_libs=
  2767. ;;
  2768. sunos)
  2769. AVSERVERLDFLAGS=""
  2770. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2771. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2772. network_extralibs="-lsocket -lnsl"
  2773. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2774. # When using suncc to build, the Solaris linker will mark
  2775. # an executable with each instruction set encountered by
  2776. # the Solaris assembler. As our libraries contain their own
  2777. # guards for processor-specific code, instead suppress
  2778. # generation of the HWCAPS ELF section on Solaris x86 only.
  2779. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2780. nm_default='nm -P -g'
  2781. ;;
  2782. netbsd)
  2783. disable symver
  2784. oss_indev_extralibs="-lossaudio"
  2785. oss_outdev_extralibs="-lossaudio"
  2786. ;;
  2787. openbsd|bitrig)
  2788. disable symver
  2789. SHFLAGS='-shared'
  2790. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  2791. SLIB_INSTALL_LINKS=
  2792. oss_indev_extralibs="-lossaudio"
  2793. oss_outdev_extralibs="-lossaudio"
  2794. ;;
  2795. dragonfly)
  2796. disable symver
  2797. ;;
  2798. freebsd)
  2799. ;;
  2800. bsd/os)
  2801. add_extralibs -lpoll -lgnugetopt
  2802. ;;
  2803. darwin)
  2804. gas="gas-preprocessor.pl $cc"
  2805. enabled ppc && add_asflags -force_cpusubtype_ALL
  2806. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2807. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2808. add_ldflags -Wl,-dynamic,-search_paths_first
  2809. SLIBSUF=".dylib"
  2810. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2811. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2812. AVSERVERLDFLAGS=-Wl,-bind_at_load
  2813. objformat="macho"
  2814. enabled x86_64 && objformat="macho64"
  2815. enabled_any pic shared ||
  2816. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2817. ;;
  2818. mingw32*)
  2819. if test $target_os = "mingw32ce"; then
  2820. disable network
  2821. else
  2822. target_os=mingw32
  2823. fi
  2824. LIBTARGET=i386
  2825. if enabled x86_64; then
  2826. LIBTARGET="i386:x86-64"
  2827. elif enabled arm; then
  2828. LIBTARGET=arm-wince
  2829. fi
  2830. check_ldflags -Wl,--nxcompat
  2831. check_ldflags -Wl,--dynamicbase
  2832. shlibdir_default="$bindir_default"
  2833. SLIBPREF=""
  2834. SLIBSUF=".dll"
  2835. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2836. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2837. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2838. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2839. SLIB_INSTALL_LINKS=
  2840. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2841. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2842. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  2843. objformat="win32"
  2844. dlltool="${cross_prefix}dlltool"
  2845. ranlib=:
  2846. enable dos_paths
  2847. disable pic
  2848. ;;
  2849. win32|win64)
  2850. if enabled shared; then
  2851. # Link to the import library instead of the normal static library
  2852. # for shared libs.
  2853. LD_LIB='%.lib'
  2854. # Cannot build shared and static libraries at the same time with
  2855. # MSVC.
  2856. disable static
  2857. fi
  2858. shlibdir_default="$bindir_default"
  2859. SLIBPREF=""
  2860. SLIBSUF=".dll"
  2861. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2862. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2863. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  2864. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2865. SLIB_INSTALL_LINKS=
  2866. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2867. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2868. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2869. objformat="win32"
  2870. ranlib=:
  2871. enable dos_paths
  2872. disable pic
  2873. ;;
  2874. cygwin*)
  2875. target_os=cygwin
  2876. shlibdir_default="$bindir_default"
  2877. SLIBPREF="cyg"
  2878. SLIBSUF=".dll"
  2879. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2880. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2881. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2882. SLIB_INSTALL_LINKS=
  2883. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  2884. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  2885. objformat="win32"
  2886. enable dos_paths
  2887. disable pic
  2888. ;;
  2889. *-dos|freedos|opendos)
  2890. network_extralibs="-lsocket"
  2891. objformat="coff"
  2892. enable dos_paths
  2893. add_cppflags -U__STRICT_ANSI__
  2894. ;;
  2895. linux)
  2896. enable dv1394
  2897. ;;
  2898. irix*)
  2899. target_os=irix
  2900. ranlib="echo ignoring ranlib"
  2901. ;;
  2902. os/2*)
  2903. ln_s="cp -f"
  2904. objformat="aout"
  2905. add_cppflags -D_GNU_SOURCE
  2906. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2907. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2908. AVSERVERLDFLAGS=""
  2909. LIBSUF="_s.a"
  2910. SLIBPREF=""
  2911. SLIBSUF=".dll"
  2912. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2913. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2914. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2915. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2916. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2917. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2918. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2919. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2920. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2921. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2922. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2923. enable dos_paths
  2924. ;;
  2925. gnu/kfreebsd)
  2926. add_cppflags -D_BSD_SOURCE
  2927. ;;
  2928. gnu)
  2929. ;;
  2930. qnx)
  2931. add_cppflags -D_QNX_SOURCE
  2932. network_extralibs="-lsocket"
  2933. ;;
  2934. symbian)
  2935. SLIBSUF=".dll"
  2936. enable dos_paths
  2937. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2938. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2939. add_ldflags -Wl,--target1-abs,--no-undefined \
  2940. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2941. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2942. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2943. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2944. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2945. ;;
  2946. osf1)
  2947. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  2948. AVSERVERLDFLAGS=
  2949. ;;
  2950. minix)
  2951. ;;
  2952. plan9)
  2953. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  2954. -D_REENTRANT_SOURCE \
  2955. -D_RESEARCH_SOURCE \
  2956. -DFD_SETSIZE=96 \
  2957. -DHAVE_SOCK_OPTS
  2958. add_compat strtod.o strtod=avpriv_strtod
  2959. network_extralibs='-lbsd'
  2960. exeobjs=compat/plan9/main.o
  2961. disable avserver
  2962. cp_f='cp'
  2963. ;;
  2964. none)
  2965. ;;
  2966. *)
  2967. die "Unknown OS '$target_os'."
  2968. ;;
  2969. esac
  2970. # determine libc flavour
  2971. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  2972. if check_cpp_condition features.h "defined __UCLIBC__"; then
  2973. libc_type=uclibc
  2974. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2975. elif check_cpp_condition features.h "defined __GLIBC__"; then
  2976. libc_type=glibc
  2977. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2978. # MinGW headers can be installed on Cygwin, so check for newlib first.
  2979. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  2980. libc_type=newlib
  2981. add_cppflags -U__STRICT_ANSI__
  2982. elif check_header _mingw.h; then
  2983. libc_type=mingw
  2984. check_cpp_condition _mingw.h \
  2985. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  2986. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2987. die "ERROR: MinGW runtime version must be >= 3.15."
  2988. add_cppflags -U__STRICT_ANSI__
  2989. elif check_func_headers stdlib.h _get_doserrno; then
  2990. libc_type=msvcrt
  2991. add_compat strtod.o strtod=avpriv_strtod
  2992. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  2993. _snprintf=avpriv_snprintf \
  2994. vsnprintf=avpriv_vsnprintf
  2995. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  2996. # 0x601 by default unless something else is set by the user.
  2997. # This can easily lead to us detecting functions only present
  2998. # in such new versions and producing binaries requiring windows 7.0.
  2999. # Therefore explicitly set the default to XP unless the user has
  3000. # set something else on the command line.
  3001. check_cpp_condition stdlib.h "defined(_WIN32_WINNT)" || add_cppflags -D_WIN32_WINNT=0x0502
  3002. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  3003. libc_type=klibc
  3004. elif check_cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3005. libc_type=bionic
  3006. add_compat strtod.o strtod=avpriv_strtod
  3007. fi
  3008. test -n "$libc_type" && enable $libc_type
  3009. # hacks for compiler/libc/os combinations
  3010. if enabled_all tms470 glibc; then
  3011. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3012. add_cppflags -D__USER_LABEL_PREFIX__=
  3013. add_cppflags -D__builtin_memset=memset
  3014. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3015. add_cflags -pds=48 # incompatible redefinition of macro
  3016. fi
  3017. if enabled_all ccc glibc; then
  3018. add_ldflags -Wl,-z,now # calls to libots crash without this
  3019. fi
  3020. esc(){
  3021. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3022. }
  3023. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  3024. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3025. set_default $PATHS_LIST
  3026. set_default nm
  3027. # we need to build at least one lib type
  3028. if ! enabled_any static shared; then
  3029. cat <<EOF
  3030. At least one library type must be built.
  3031. Specify --enable-static to build the static libraries or --enable-shared to
  3032. build the shared libraries as well. To only build the shared libraries specify
  3033. --disable-static in addition to --enable-shared.
  3034. EOF
  3035. exit 1;
  3036. fi
  3037. die_license_disabled() {
  3038. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3039. }
  3040. die_license_disabled gpl libcdio
  3041. die_license_disabled gpl libx264
  3042. die_license_disabled gpl libxavs
  3043. die_license_disabled gpl libxvid
  3044. die_license_disabled gpl x11grab
  3045. die_license_disabled nonfree libfaac
  3046. die_license_disabled nonfree libfdk_aac
  3047. die_license_disabled nonfree openssl
  3048. die_license_disabled version3 libopencore_amrnb
  3049. die_license_disabled version3 libopencore_amrwb
  3050. die_license_disabled version3 libvo_aacenc
  3051. die_license_disabled version3 libvo_amrwbenc
  3052. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3053. disabled optimizations || check_cflags -fomit-frame-pointer
  3054. enable_weak_pic() {
  3055. disabled pic && return
  3056. enable pic
  3057. add_cppflags -DPIC
  3058. add_cflags -fPIC
  3059. add_asflags -fPIC
  3060. }
  3061. enabled pic && enable_weak_pic
  3062. check_cc <<EOF || die "Symbol mangling check failed."
  3063. int ff_extern;
  3064. EOF
  3065. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3066. extern_prefix=${sym%%ff_extern*}
  3067. check_cc <<EOF && enable_weak inline_asm
  3068. void foo(void) { __asm__ volatile ("" ::); }
  3069. EOF
  3070. _restrict=
  3071. for restrict_keyword in restrict __restrict__ __restrict; do
  3072. check_cc <<EOF && _restrict=$restrict_keyword && break
  3073. void foo(char * $restrict_keyword p);
  3074. EOF
  3075. done
  3076. check_cc <<EOF && enable attribute_packed
  3077. struct { int x; } __attribute__((packed)) x;
  3078. EOF
  3079. check_cc <<EOF && enable attribute_may_alias
  3080. union { int x; } __attribute__((may_alias)) x;
  3081. EOF
  3082. check_cc <<EOF || die "endian test failed"
  3083. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3084. EOF
  3085. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3086. if enabled alpha; then
  3087. check_cflags -mieee
  3088. elif enabled arm; then
  3089. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3090. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3091. nogas=die
  3092. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3093. enable vfp_args
  3094. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3095. case "${cross_prefix:-$cc}" in
  3096. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3097. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3098. __asm__ (".eabi_attribute 28, 1");
  3099. int main(void) { return 0; }
  3100. EOF
  3101. esac
  3102. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3103. fi
  3104. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3105. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3106. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3107. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3108. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3109. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3110. [ $target_os = linux ] ||
  3111. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3112. $ARCH_EXT_LIST_ARM
  3113. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3114. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3115. enabled_all armv6t2 shared !pic && enable_weak_pic
  3116. elif enabled mips; then
  3117. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3118. elif enabled parisc; then
  3119. if enabled gcc; then
  3120. case $($cc -dumpversion) in
  3121. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3122. esac
  3123. fi
  3124. elif enabled ppc; then
  3125. enable local_aligned_8 local_aligned_16
  3126. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3127. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3128. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3129. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3130. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3131. if enabled altivec; then
  3132. nogas=warn
  3133. check_cflags -maltivec -mabi=altivec &&
  3134. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3135. check_cflags -faltivec
  3136. # check if our compiler supports Motorola AltiVec C API
  3137. check_cc <<EOF || disable altivec
  3138. $inc_altivec_h
  3139. int main(void) {
  3140. vector signed int v1 = (vector signed int) { 0 };
  3141. vector signed int v2 = (vector signed int) { 1 };
  3142. v1 = vec_add(v1, v2);
  3143. return 0;
  3144. }
  3145. EOF
  3146. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3147. fi
  3148. elif enabled sparc; then
  3149. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3150. elif enabled x86; then
  3151. check_builtin rdtsc intrin.h "__rdtsc()"
  3152. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3153. enable local_aligned_8 local_aligned_16
  3154. # check whether EBP is available on x86
  3155. # As 'i' is stored on the stack, this program will crash
  3156. # if the base pointer is used to access it because the
  3157. # base pointer is cleared in the inline assembly code.
  3158. check_exec_crash <<EOF && enable ebp_available
  3159. volatile int i=0;
  3160. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3161. return i;
  3162. EOF
  3163. # check whether EBX is available on x86
  3164. check_inline_asm ebx_available '""::"b"(0)' &&
  3165. check_inline_asm ebx_available '"":::"%ebx"'
  3166. # check whether xmm clobbers are supported
  3167. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3168. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3169. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3170. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3171. if ! disabled_any asm mmx yasm; then
  3172. if check_cmd $yasmexe --version; then
  3173. enabled x86_64 && yasm_extra="-m amd64"
  3174. yasm_debug="-g dwarf2"
  3175. elif check_cmd nasm -v; then
  3176. yasmexe=nasm
  3177. yasm_debug="-g -F dwarf"
  3178. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3179. fi
  3180. YASMFLAGS="-f $objformat $yasm_extra"
  3181. enabled pic && append YASMFLAGS "-DPIC"
  3182. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3183. case "$objformat" in
  3184. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3185. esac
  3186. check_yasm "vextractf128 xmm0, ymm0, 0" && enable yasm ||
  3187. die "yasm not found, use --disable-yasm for a crippled build"
  3188. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3189. check_yasm "CPU amdnop" && enabled i686 && enable cpunop
  3190. fi
  3191. case "$cpu" in
  3192. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3193. disable fast_clz
  3194. ;;
  3195. esac
  3196. fi
  3197. if enabled asm; then
  3198. as=${gas:=$as}
  3199. check_as <<EOF && enable gnu_as || \
  3200. $nogas "GNU assembler not found, install gas-preprocessor"
  3201. .macro m n
  3202. \n: .int 0
  3203. .endm
  3204. m x
  3205. EOF
  3206. fi
  3207. check_ldflags -Wl,--as-needed
  3208. if check_func dlopen; then
  3209. ldl=
  3210. elif check_func dlopen -ldl; then
  3211. ldl=-ldl
  3212. fi
  3213. if ! disabled network; then
  3214. check_type "sys/types.h sys/socket.h" socklen_t
  3215. check_type netdb.h "struct addrinfo"
  3216. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3217. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3218. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3219. check_type netinet/in.h "struct sockaddr_in6"
  3220. check_type poll.h "struct pollfd"
  3221. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3222. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3223. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3224. check_func getaddrinfo $network_extralibs
  3225. check_func getservbyport $network_extralibs
  3226. # Prefer arpa/inet.h over winsock2
  3227. if check_header arpa/inet.h ; then
  3228. check_func closesocket
  3229. elif check_header winsock2.h ; then
  3230. check_func_headers winsock2.h closesocket -lws2 &&
  3231. network_extralibs="-lws2" ||
  3232. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3233. network_extralibs="-lws2_32"; }
  3234. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3235. check_type ws2tcpip.h socklen_t
  3236. check_type ws2tcpip.h "struct addrinfo"
  3237. check_type ws2tcpip.h "struct group_source_req"
  3238. check_type ws2tcpip.h "struct ip_mreq_source"
  3239. check_type ws2tcpip.h "struct ipv6_mreq"
  3240. check_type winsock2.h "struct pollfd"
  3241. check_type ws2tcpip.h "struct sockaddr_in6"
  3242. check_type ws2tcpip.h "struct sockaddr_storage"
  3243. check_struct winsock2.h "struct sockaddr" sa_len
  3244. else
  3245. disable network
  3246. fi
  3247. fi
  3248. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3249. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3250. check_func fcntl
  3251. check_func fork
  3252. check_func_headers stdlib.h getenv
  3253. check_func gethrtime
  3254. check_func getopt
  3255. check_func getrusage
  3256. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3257. check_func gettimeofday
  3258. check_func inet_aton $network_extralibs
  3259. check_func isatty
  3260. check_func localtime_r
  3261. check_func ${malloc_prefix}memalign && enable memalign
  3262. check_func mkstemp
  3263. check_func mmap
  3264. check_func mprotect
  3265. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3266. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3267. check_func setrlimit
  3268. check_func strerror_r
  3269. check_func strptime
  3270. check_func strtok_r
  3271. check_func sched_getaffinity
  3272. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3273. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3274. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3275. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3276. check_func sysconf
  3277. check_func sysctl
  3278. check_func usleep
  3279. check_func_headers io.h setmode
  3280. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3281. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3282. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3283. check_func_headers windows.h GetProcessAffinityMask
  3284. check_func_headers windows.h GetProcessTimes
  3285. check_func_headers windows.h GetSystemTimeAsFileTime
  3286. check_func_headers windows.h MapViewOfFile
  3287. check_func_headers windows.h SetConsoleTextAttribute
  3288. check_func_headers windows.h Sleep
  3289. check_func_headers windows.h VirtualAlloc
  3290. check_header direct.h
  3291. check_header dlfcn.h
  3292. check_header dxva.h
  3293. check_header dxva2api.h
  3294. check_header io.h
  3295. check_header malloc.h
  3296. check_header poll.h
  3297. check_header sys/mman.h
  3298. check_header sys/param.h
  3299. check_header sys/resource.h
  3300. check_header sys/select.h
  3301. check_header sys/time.h
  3302. check_header unistd.h
  3303. check_header vdpau/vdpau.h
  3304. check_header vdpau/vdpau_x11.h
  3305. check_header VideoDecodeAcceleration/VDADecoder.h
  3306. check_header windows.h
  3307. check_header X11/extensions/XvMClib.h
  3308. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3309. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3310. if ! disabled w32threads && ! enabled pthreads; then
  3311. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3312. fi
  3313. # check for some common methods of building with pthread support
  3314. # do this before the optional library checks as some of them require pthreads
  3315. if ! disabled pthreads && ! enabled w32threads; then
  3316. enable pthreads
  3317. if check_func pthread_create; then
  3318. :
  3319. elif check_func pthread_create -pthread; then
  3320. add_cflags -pthread
  3321. add_extralibs -pthread
  3322. elif check_func pthread_create -pthreads; then
  3323. add_cflags -pthreads
  3324. add_extralibs -pthreads
  3325. elif check_func pthread_create -lpthreadGC2; then
  3326. add_extralibs -lpthreadGC2
  3327. elif ! check_lib pthread.h pthread_create -lpthread; then
  3328. disable pthreads
  3329. fi
  3330. fi
  3331. for thread in $THREADS_LIST; do
  3332. if enabled $thread; then
  3333. test -n "$thread_type" &&
  3334. die "ERROR: Only one thread type must be selected." ||
  3335. thread_type="$thread"
  3336. fi
  3337. done
  3338. enabled sync_val_compare_and_swap && enable atomics_gcc
  3339. enabled machine_rw_barrier && enabled atomic_cas_ptr && enable atomics_suncc
  3340. enabled MemoryBarrier && enable atomics_win32
  3341. check_lib math.h sin -lm && LIBM="-lm"
  3342. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3343. atan2f_args=2
  3344. ldexpf_args=2
  3345. powf_args=2
  3346. for func in $MATH_FUNCS; do
  3347. eval check_mathfunc $func \${${func}_args:-1}
  3348. done
  3349. # these are off by default, so fail if requested and not available
  3350. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  3351. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3352. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3353. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3354. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3355. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3356. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3357. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3358. done || die "ERROR: libgsm not found"; }
  3359. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3360. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3361. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3362. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3363. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  3364. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  3365. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3366. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3367. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3368. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3369. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3370. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3371. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3372. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3373. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3374. enabled libvpx && {
  3375. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3376. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3377. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  3378. die "ERROR: libvpx encoder version must be >=0.9.6"; }
  3379. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3380. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3381. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3382. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3383. die "ERROR: libx264 version must be >= 0.118."; }
  3384. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3385. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3386. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3387. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3388. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3389. die "ERROR: openssl not found"; }
  3390. if enabled gnutls; then
  3391. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3392. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3393. fi
  3394. # libdc1394 check
  3395. if enabled libdc1394; then
  3396. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3397. enable libdc1394_2; } ||
  3398. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3399. enable libdc1394_1; } ||
  3400. die "ERROR: No version of libdc1394 found "
  3401. fi
  3402. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3403. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3404. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3405. enable sdl
  3406. fi
  3407. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  3408. check_header linux/fb.h
  3409. check_header linux/videodev2.h
  3410. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3411. check_header sys/videoio.h
  3412. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3413. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3414. # w32api 3.12 had it defined wrong
  3415. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3416. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3417. { check_header dev/bktr/ioctl_meteor.h &&
  3418. check_header dev/bktr/ioctl_bt848.h; } ||
  3419. { check_header machine/ioctl_meteor.h &&
  3420. check_header machine/ioctl_bt848.h; } ||
  3421. { check_header dev/video/meteor/ioctl_meteor.h &&
  3422. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3423. check_header dev/ic/bt8xx.h
  3424. check_header sndio.h
  3425. check_header sys/soundcard.h
  3426. check_header soundcard.h
  3427. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3428. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  3429. check_func jack_port_get_latency_range -ljack
  3430. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3431. if enabled libcdio; then
  3432. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
  3433. fi
  3434. enabled x11grab &&
  3435. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3436. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3437. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3438. enabled vdpau &&
  3439. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3440. disable vdpau
  3441. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3442. # add some useful compiler flags if supported
  3443. check_cflags -Wdeclaration-after-statement
  3444. check_cflags -Wall
  3445. check_cflags -Wno-parentheses
  3446. check_cflags -Wno-switch
  3447. check_cflags -Wno-format-zero-length
  3448. check_cflags -Wdisabled-optimization
  3449. check_cflags -Wpointer-arith
  3450. check_cflags -Wredundant-decls
  3451. check_cflags -Wno-pointer-sign
  3452. check_cflags -Wcast-qual
  3453. check_cflags -Wwrite-strings
  3454. check_cflags -Wtype-limits
  3455. check_cflags -Wundef
  3456. check_cflags -Wmissing-prototypes
  3457. check_cflags -Wstrict-prototypes
  3458. enabled extra_warnings && check_cflags -Winline
  3459. # add some linker flags
  3460. check_ldflags -Wl,--warn-common
  3461. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3462. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3463. enabled xmm_clobber_test &&
  3464. check_ldflags -Wl,--wrap,avcodec_open2 \
  3465. -Wl,--wrap,avcodec_decode_audio4 \
  3466. -Wl,--wrap,avcodec_decode_video2 \
  3467. -Wl,--wrap,avcodec_decode_subtitle2 \
  3468. -Wl,--wrap,avcodec_encode_audio2 \
  3469. -Wl,--wrap,avcodec_encode_video \
  3470. -Wl,--wrap,avcodec_encode_subtitle \
  3471. -Wl,--wrap,sws_scale ||
  3472. disable xmm_clobber_test
  3473. echo "X{};" > $TMPV
  3474. if test_ldflags -Wl,--version-script,$TMPV; then
  3475. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3476. check_cc <<EOF && enable symver_asm_label
  3477. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3478. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3479. EOF
  3480. check_cc <<EOF && enable symver_gnu_asm
  3481. __asm__(".symver ff_foo,av_foo@VERSION");
  3482. void ff_foo(void) {}
  3483. EOF
  3484. fi
  3485. if [ -z "$optflags" ]; then
  3486. if enabled small; then
  3487. optflags=$cflags_size
  3488. elif enabled optimizations; then
  3489. optflags=$cflags_speed
  3490. else
  3491. optflags=$cflags_noopt
  3492. fi
  3493. fi
  3494. check_optflags(){
  3495. check_cflags "$@"
  3496. enabled lto && check_ldflags "$@"
  3497. }
  3498. if enabled lto; then
  3499. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3500. check_cflags -flto
  3501. check_ldflags -flto $cpuflags
  3502. fi
  3503. check_optflags $optflags
  3504. check_optflags -fno-math-errno
  3505. check_optflags -fno-signed-zeros
  3506. if enabled icc; then
  3507. # Just warnings, no remarks
  3508. check_cflags -w1
  3509. # -wd: Disable following warnings
  3510. # 144, 167, 556: -Wno-pointer-sign
  3511. # 1292: attribute "foo" ignored
  3512. # 1419: external declaration in primary source file
  3513. # 10006: ignoring unknown option -fno-signed-zeros
  3514. # 10148: ignoring unknown option -Wno-parentheses
  3515. # 10156: ignoring option '-W'; no argument required
  3516. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  3517. # 11030: Warning unknown option --as-needed
  3518. # 10156: ignoring option '-export'; no argument required
  3519. check_ldflags -wd10156,11030
  3520. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3521. enable ebp_available
  3522. if enabled x86_32; then
  3523. icc_version=$($cc -dumpversion)
  3524. test ${icc_version%%.*} -ge 11 &&
  3525. check_cflags -falign-stack=maintain-16-byte ||
  3526. disable aligned_stack
  3527. fi
  3528. elif enabled ccc; then
  3529. # disable some annoying warnings
  3530. add_cflags -msg_disable bitnotint
  3531. add_cflags -msg_disable mixfuncvoid
  3532. add_cflags -msg_disable nonstandcast
  3533. add_cflags -msg_disable unsupieee
  3534. elif enabled gcc; then
  3535. check_optflags -fno-tree-vectorize
  3536. check_cflags -Werror=implicit-function-declaration
  3537. check_cflags -Werror=missing-prototypes
  3538. check_cflags -Werror=return-type
  3539. check_cflags -Werror=declaration-after-statement
  3540. check_cflags -Werror=vla
  3541. elif enabled llvm_gcc; then
  3542. check_cflags -mllvm -stack-alignment=16
  3543. elif enabled clang; then
  3544. check_cflags -mllvm -stack-alignment=16
  3545. check_cflags -Qunused-arguments
  3546. check_cflags -Werror=implicit-function-declaration
  3547. check_cflags -Werror=missing-prototypes
  3548. check_cflags -Werror=return-type
  3549. elif enabled armcc; then
  3550. # 2523: use of inline assembler is deprecated
  3551. add_cflags -W${armcc_opt},--diag_suppress=2523
  3552. add_cflags -W${armcc_opt},--diag_suppress=1207
  3553. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3554. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3555. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3556. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3557. elif enabled tms470; then
  3558. add_cflags -pds=824 -pds=837
  3559. elif enabled pathscale; then
  3560. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3561. elif enabled msvc; then
  3562. enabled x86_32 && disable aligned_stack
  3563. elif enabled icl; then
  3564. enabled x86_32 && disable aligned_stack
  3565. # basically -fstrict-aliasing for icl that doesn't work (correctly) on 13.x+
  3566. check_cpp_condition "windows.h" "__ICL < 1300" && add_cflags -Qansi-alias
  3567. # icl will pass the inline asm tests but inline asm is currently not supported (build will fail)
  3568. disable inline_asm
  3569. fi
  3570. case $target_os in
  3571. osf1)
  3572. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  3573. ;;
  3574. plan9)
  3575. add_cppflags -Dmain=plan9_main
  3576. ;;
  3577. esac
  3578. enabled_any $THREADS_LIST && enable threads
  3579. enabled_any $ATOMICS_LIST && enable atomics_native
  3580. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3581. check_deps $CONFIG_LIST \
  3582. $CONFIG_EXTRA \
  3583. $HAVE_LIST \
  3584. $ALL_COMPONENTS \
  3585. ! enabled_any memalign posix_memalign aligned_malloc &&
  3586. enabled_any $need_memalign && enable memalign_hack
  3587. echo "install prefix $prefix"
  3588. echo "source path $source_path"
  3589. echo "C compiler $cc"
  3590. echo "ARCH $arch ($cpu)"
  3591. if test "$build_suffix" != ""; then
  3592. echo "build suffix $build_suffix"
  3593. fi
  3594. if test "$extra_version" != ""; then
  3595. echo "version string suffix $extra_version"
  3596. fi
  3597. echo "big-endian ${bigendian-no}"
  3598. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3599. if enabled x86; then
  3600. echo "${yasmexe} ${yasm-no}"
  3601. echo "MMX enabled ${mmx-no}"
  3602. echo "MMXEXT enabled ${mmxext-no}"
  3603. echo "3DNow! enabled ${amd3dnow-no}"
  3604. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3605. echo "SSE enabled ${sse-no}"
  3606. echo "SSSE3 enabled ${ssse3-no}"
  3607. echo "AVX enabled ${avx-no}"
  3608. echo "FMA4 enabled ${fma4-no}"
  3609. echo "i686 features enabled ${i686-no}"
  3610. echo "CMOV is fast ${fast_cmov-no}"
  3611. echo "EBX available ${ebx_available-no}"
  3612. echo "EBP available ${ebp_available-no}"
  3613. fi
  3614. if enabled arm; then
  3615. echo "ARMv5TE enabled ${armv5te-no}"
  3616. echo "ARMv6 enabled ${armv6-no}"
  3617. echo "ARMv6T2 enabled ${armv6t2-no}"
  3618. echo "VFP enabled ${vfp-no}"
  3619. echo "NEON enabled ${neon-no}"
  3620. fi
  3621. if enabled ppc; then
  3622. echo "AltiVec enabled ${altivec-no}"
  3623. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3624. echo "dcbzl available ${dcbzl-no}"
  3625. fi
  3626. if enabled sparc; then
  3627. echo "VIS enabled ${vis-no}"
  3628. fi
  3629. echo "debug symbols ${debug-no}"
  3630. echo "optimize for size ${small-no}"
  3631. echo "optimizations ${optimizations-no}"
  3632. echo "static ${static-no}"
  3633. echo "shared ${shared-no}"
  3634. echo "new filter support ${avfilter-no}"
  3635. echo "network support ${network-no}"
  3636. echo "threading support ${thread_type-no}"
  3637. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3638. echo "SDL support ${sdl-no}"
  3639. test -n "$random_seed" &&
  3640. echo "random seed ${random_seed}"
  3641. echo
  3642. echo "External libraries:"
  3643. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  3644. echo
  3645. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3646. echo "Enabled ${type}s:"
  3647. eval list=\$$(toupper $type)_LIST
  3648. print_enabled '_*' $list | print_3_columns
  3649. echo
  3650. done
  3651. license="LGPL version 2.1 or later"
  3652. if enabled nonfree; then
  3653. license="nonfree and unredistributable"
  3654. elif enabled gplv3; then
  3655. license="GPL version 3 or later"
  3656. elif enabled lgplv3; then
  3657. license="LGPL version 3 or later"
  3658. elif enabled gpl; then
  3659. license="GPL version 2 or later"
  3660. fi
  3661. echo "License: $license"
  3662. echo "Creating config.mak and config.h..."
  3663. test -e Makefile || $ln_s "$source_path/Makefile" .
  3664. config_files="$TMPH config.mak"
  3665. cat > config.mak <<EOF
  3666. # Automatically generated by configure - do not modify!
  3667. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  3668. prefix=$prefix
  3669. LIBDIR=\$(DESTDIR)$libdir
  3670. SHLIBDIR=\$(DESTDIR)$shlibdir
  3671. INCDIR=\$(DESTDIR)$incdir
  3672. BINDIR=\$(DESTDIR)$bindir
  3673. DATADIR=\$(DESTDIR)$datadir
  3674. MANDIR=\$(DESTDIR)$mandir
  3675. SRC_PATH=$source_path
  3676. CC_IDENT=$cc_ident
  3677. ARCH=$arch
  3678. CC=$cc
  3679. AS=$as
  3680. LD=$ld
  3681. DEPCC=$dep_cc
  3682. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  3683. DEPAS=$as
  3684. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  3685. YASM=$yasmexe
  3686. DEPYASM=$yasmexe
  3687. AR=$ar
  3688. ARFLAGS=$arflags
  3689. AR_O=$ar_o
  3690. RANLIB=$ranlib
  3691. LN_S=$ln_s
  3692. CPPFLAGS=$CPPFLAGS
  3693. CFLAGS=$CFLAGS
  3694. ASFLAGS=$ASFLAGS
  3695. AS_C=$AS_C
  3696. AS_O=$AS_O
  3697. CC_C=$CC_C
  3698. CC_E=$CC_E
  3699. CC_O=$CC_O
  3700. LD_O=$LD_O
  3701. LD_LIB=$LD_LIB
  3702. LD_PATH=$LD_PATH
  3703. DLLTOOL=$dlltool
  3704. LDFLAGS=$LDFLAGS
  3705. LDFLAGS-avserver=$AVSERVERLDFLAGS
  3706. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  3707. YASMFLAGS=$YASMFLAGS
  3708. BUILDSUF=$build_suffix
  3709. FULLNAME=$FULLNAME
  3710. LIBPREF=$LIBPREF
  3711. LIBSUF=$LIBSUF
  3712. LIBNAME=$LIBNAME
  3713. SLIBPREF=$SLIBPREF
  3714. SLIBSUF=$SLIBSUF
  3715. EXESUF=$EXESUF
  3716. EXTRA_VERSION=$extra_version
  3717. CCDEP=$CCDEP
  3718. CCDEP_FLAGS=$CCDEP_FLAGS
  3719. ASDEP=$ASDEP
  3720. ASDEP_FLAGS=$ASDEP_FLAGS
  3721. CC_DEPFLAGS=$CC_DEPFLAGS
  3722. AS_DEPFLAGS=$AS_DEPFLAGS
  3723. HOSTCC=$host_cc
  3724. HOSTLD=$host_ld
  3725. HOSTCFLAGS=$host_cflags
  3726. HOSTCPPFLAGS=$host_cppflags
  3727. HOSTEXESUF=$HOSTEXESUF
  3728. HOSTLDFLAGS=$host_ldflags
  3729. HOSTLIBS=$host_libs
  3730. DEPHOSTCC=$host_cc
  3731. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  3732. HOSTCCDEP=$HOSTCCDEP
  3733. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  3734. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  3735. HOSTCC_C=$HOSTCC_C
  3736. HOSTCC_O=$HOSTCC_O
  3737. HOSTLD_O=$HOSTLD_O
  3738. TARGET_EXEC=$target_exec $target_exec_args
  3739. TARGET_PATH=$target_path
  3740. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  3741. LIBS-avplay=$sdl_libs
  3742. CFLAGS-avplay=$sdl_cflags
  3743. ZLIB=$($ldflags_filter -lz)
  3744. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3745. EXTRALIBS=$extralibs
  3746. COMPAT_OBJS=$compat_objs
  3747. EXEOBJS=$exeobjs
  3748. INSTALL=install
  3749. LIBTARGET=${LIBTARGET}
  3750. SLIBNAME=${SLIBNAME}
  3751. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3752. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3753. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3754. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3755. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3756. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3757. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3758. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3759. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  3760. EOF
  3761. get_version(){
  3762. lcname=lib${1}
  3763. name=$(toupper $lcname)
  3764. file=$source_path/$lcname/version.h
  3765. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  3766. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3767. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3768. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3769. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  3770. }
  3771. map 'get_version $v' $LIBRARY_LIST
  3772. cat > $TMPH <<EOF
  3773. /* Automatically generated by configure - do not modify! */
  3774. #ifndef LIBAV_CONFIG_H
  3775. #define LIBAV_CONFIG_H
  3776. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  3777. #define LIBAV_LICENSE "$(c_escape $license)"
  3778. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3779. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  3780. #define restrict $_restrict
  3781. #define EXTERN_PREFIX "${extern_prefix}"
  3782. #define EXTERN_ASM ${extern_prefix}
  3783. #define SLIBSUF "$SLIBSUF"
  3784. EOF
  3785. test -n "$malloc_prefix" &&
  3786. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3787. if enabled yasm; then
  3788. append config_files $TMPASM
  3789. printf '' >$TMPASM
  3790. fi
  3791. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  3792. print_config ARCH_ "$config_files" $ARCH_LIST
  3793. print_config HAVE_ "$config_files" $HAVE_LIST
  3794. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3795. $CONFIG_EXTRA \
  3796. $ALL_COMPONENTS \
  3797. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  3798. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3799. cp_if_changed $TMPH config.h
  3800. touch .config
  3801. enabled yasm && cp_if_changed $TMPASM config.asm
  3802. cat > $TMPH <<EOF
  3803. /* Generated by ffconf */
  3804. #ifndef AVUTIL_AVCONFIG_H
  3805. #define AVUTIL_AVCONFIG_H
  3806. EOF
  3807. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3808. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3809. cp_if_changed $TMPH libavutil/avconfig.h
  3810. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3811. # build pkg-config files
  3812. pkgconfig_generate(){
  3813. name=$1
  3814. shortname=${name#lib}${build_suffix}
  3815. comment=$2
  3816. version=$3
  3817. libs=$4
  3818. requires=$5
  3819. enabled ${name#lib} || return 0
  3820. mkdir -p $name
  3821. cat <<EOF > $name/$name.pc
  3822. prefix=$prefix
  3823. exec_prefix=\${prefix}
  3824. libdir=$libdir
  3825. includedir=$incdir
  3826. Name: $name
  3827. Description: $comment
  3828. Version: $version
  3829. Requires: $(enabled shared || echo $requires)
  3830. Requires.private: $(enabled shared && echo $requires)
  3831. Conflicts:
  3832. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3833. Libs.private: $(enabled shared && echo $libs)
  3834. Cflags: -I\${includedir}
  3835. EOF
  3836. cat <<EOF > $name/$name-uninstalled.pc
  3837. prefix=
  3838. exec_prefix=
  3839. libdir=\${pcfiledir}
  3840. includedir=${source_path}
  3841. Name: $name
  3842. Description: $comment
  3843. Version: $version
  3844. Requires: $requires
  3845. Conflicts:
  3846. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3847. Cflags: -I\${includedir}
  3848. EOF
  3849. }
  3850. lavfi_libs="libavutil = $LIBAVUTIL_VERSION"
  3851. enabled movie_filter && prepend lavfi_libs "libavformat >= $LIBAVFORMAT_VERSION, libavcodec >= $LIBAVCODEC_VERSION,"
  3852. enabled resample_filter && prepend lavfi_libs "libavresample >= $LIBAVRESAMPLE_VERSION,"
  3853. enabled scale_filter && prepend lavfi_libs "libswscale >= $LIBSWSCALE_VERSION,"
  3854. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3855. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3856. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3857. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3858. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
  3859. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3860. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"