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.

4251 lines
125KB

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