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.

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