You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4294 lines
126KB

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