2 # Process this file with autoconf to produce a configure script.
4 ###############################################################################
8 # This file has been put into the public domain.
9 # You can do whatever you want with this file.
11 ###############################################################################
13 # NOTE: Don't add useless checks. autoscan detects this and that, but don't
14 # let it confuse you. For example, we don't care about checking for behavior
15 # of malloc(), stat(), or lstat(), since we don't use those functions in
16 # a way that would cause the problems the autoconf macros check.
20 AC_INIT([XZ Utils], m4_esyscmd([/bin/sh build-aux/version.sh]),
21 [lasse.collin@tukaani.org], [xz], [https://tukaani.org/xz/])
22 AC_CONFIG_SRCDIR([src/liblzma/common/common.h])
23 AC_CONFIG_AUX_DIR([build-aux])
24 AC_CONFIG_MACRO_DIR([m4])
25 AC_CONFIG_HEADER([config.h])
28 echo "$PACKAGE_STRING"
32 # This is needed to know if assembler optimizations can be used.
35 # We do some special things on Windows (32-bit or 64-bit) builds.
37 mingw* | cygwin | msys) is_w32=yes ;;
40 AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
42 # We need to use $EXEEXT with $(LN_S) when creating symlinks to
43 # executables. Cygwin is an exception to this, since it is recommended
44 # that symlinks don't have the .exe suffix. To make this work, we
47 # MSYS2 is treated the same way as Cygwin. It uses plain "msys" like
48 # the original MSYS when building MSYS/MSYS2-binaries. Hopefully this
49 # doesn't break things for the original MSYS developers. Note that this
50 # doesn't affect normal MSYS/MSYS2 users building non-MSYS/MSYS2 binaries
51 # since in that case the $host_os is usually mingw32.
53 cygwin | msys) LN_EXEEXT= ;;
54 *) LN_EXEEXT='$(EXEEXT)' ;;
59 echo "Configure options:"
67 AC_MSG_CHECKING([if debugging code should be compiled])
68 AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debugging code.]),
70 if test "x$enable_debug" = xyes; then
73 AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debugging code.])
82 m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,sparc])dnl
83 m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,sparc])
84 m4_define([LZ_FILTERS], [lzma1,lzma2])
86 m4_foreach([NAME], [SUPPORTED_FILTERS],
87 [enable_filter_[]NAME=no
88 enable_encoder_[]NAME=no
89 enable_decoder_[]NAME=no
92 AC_MSG_CHECKING([which encoders to build])
93 AC_ARG_ENABLE([encoders], AS_HELP_STRING([--enable-encoders=LIST],
94 [Comma-separated list of encoders to build. Default=all.
96 m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])),
97 [], [enable_encoders=SUPPORTED_FILTERS])
98 enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'`
99 if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then
101 AC_MSG_RESULT([(none)])
103 for arg in $enable_encoders
105 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
107 enable_filter_[]NAME=yes
108 enable_encoder_[]NAME=yes
109 AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1],
110 [Define to 1 if] NAME [encoder is enabled.])
114 AC_MSG_ERROR([unknown filter: $arg])
118 AC_DEFINE([HAVE_ENCODERS], [1],
119 [Define to 1 if any of HAVE_ENCODER_foo have been defined.])
120 AC_MSG_RESULT([$enable_encoders])
123 AC_MSG_CHECKING([which decoders to build])
124 AC_ARG_ENABLE([decoders], AS_HELP_STRING([--enable-decoders=LIST],
125 [Comma-separated list of decoders to build. Default=all.
126 Available decoders are the same as available encoders.]),
127 [], [enable_decoders=SUPPORTED_FILTERS])
128 enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'`
129 if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then
131 AC_MSG_RESULT([(none)])
133 for arg in $enable_decoders
135 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
137 enable_filter_[]NAME=yes
138 enable_decoder_[]NAME=yes
139 AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1],
140 [Define to 1 if] NAME [decoder is enabled.])
144 AC_MSG_ERROR([unknown filter: $arg])
148 AC_DEFINE([HAVE_DECODERS], [1],
149 [Define to 1 if any of HAVE_DECODER_foo have been defined.])
150 AC_MSG_RESULT([$enable_decoders])
153 if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \
154 || test "x$enable_decoder_lzma2$enable_decoder_lzma1" = xyesno; then
155 AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.])
158 AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno)
159 AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno)
161 m4_foreach([NAME], [SUPPORTED_FILTERS],
162 [AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes)
163 AM_CONDITIONAL(COND_ENCODER_[]m4_toupper(NAME), test "x$enable_encoder_[]NAME" = xyes)
164 AM_CONDITIONAL(COND_DECODER_[]m4_toupper(NAME), test "x$enable_decoder_[]NAME" = xyes)
167 # The so called "simple filters" share common code.
168 enable_filter_simple=no
169 enable_encoder_simple=no
170 enable_decoder_simple=no
171 m4_foreach([NAME], [SIMPLE_FILTERS],
172 [test "x$enable_filter_[]NAME" = xyes && enable_filter_simple=yes
173 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_simple=yes
174 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_simple=yes
176 AM_CONDITIONAL(COND_FILTER_SIMPLE, test "x$enable_filter_simple" = xyes)
177 AM_CONDITIONAL(COND_ENCODER_SIMPLE, test "x$enable_encoder_simple" = xyes)
178 AM_CONDITIONAL(COND_DECODER_SIMPLE, test "x$enable_decoder_simple" = xyes)
180 # LZ-based filters share common code.
184 m4_foreach([NAME], [LZ_FILTERS],
185 [test "x$enable_filter_[]NAME" = xyes && enable_filter_lz=yes
186 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_lz=yes
187 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_lz=yes
189 AM_CONDITIONAL(COND_FILTER_LZ, test "x$enable_filter_lz" = xyes)
190 AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes)
191 AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes)
198 m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4])
200 m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS],
201 [enable_match_finder_[]NAME=no
204 AC_MSG_CHECKING([which match finders to build])
205 AC_ARG_ENABLE([match-finders], AS_HELP_STRING([--enable-match-finders=LIST],
206 [Comma-separated list of match finders to build. Default=all.
207 At least one match finder is required for encoding with
208 the LZMA1 and LZMA2 filters. Available match finders:]
209 m4_translit(m4_defn([SUPPORTED_MATCH_FINDERS]), [,], [ ])), [],
210 [enable_match_finders=SUPPORTED_MATCH_FINDERS])
211 enable_match_finders=`echo "$enable_match_finders" | sed 's/,/ /g'`
212 if test "x$enable_encoder_lz" = xyes ; then
213 for arg in $enable_match_finders
215 case $arg in m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [
217 enable_match_finder_[]NAME=yes
218 AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1],
219 [Define to 1 to enable] NAME [match finder.])
223 AC_MSG_ERROR([unknown match finder: $arg])
227 AC_MSG_RESULT([$enable_match_finders])
229 AC_MSG_RESULT([(none because not building any LZ-based encoder)])
237 m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256])
239 m4_foreach([NAME], [SUPPORTED_CHECKS],
240 [enable_check_[]NAME=no
243 AC_MSG_CHECKING([which integrity checks to build])
244 AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks=LIST],
245 [Comma-separated list of integrity checks to build.
246 Default=all. Available integrity checks:]
247 m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])),
248 [], [enable_checks=SUPPORTED_CHECKS])
249 enable_checks=`echo "$enable_checks" | sed 's/,/ /g'`
250 if test "x$enable_checks" = xno || test "x$enable_checks" = x; then
251 AC_MSG_RESULT([(none)])
253 for arg in $enable_checks
255 case $arg in m4_foreach([NAME], [SUPPORTED_CHECKS], [
257 enable_check_[]NAME=yes
258 AC_DEFINE(HAVE_CHECK_[]m4_toupper(NAME), [1],
259 [Define to 1 if] NAME
260 [integrity check is enabled.])
264 AC_MSG_ERROR([unknown integrity check: $arg])
268 AC_MSG_RESULT([$enable_checks])
270 if test "x$enable_check_crc32" = xno ; then
271 AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
274 m4_foreach([NAME], [SUPPORTED_CHECKS],
275 [AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes)
278 AC_MSG_CHECKING([if external SHA-256 should be used])
279 AC_ARG_ENABLE([external-sha256], AS_HELP_STRING([--enable-external-sha256],
280 [Use SHA-256 code from the operating system.
281 See INSTALL for possible subtle problems.]),
282 [], [enable_external_sha256=no])
283 if test "x$enable_check_sha256" != "xyes"; then
284 enable_external_sha256=no
286 if test "x$enable_external_sha256" = xyes; then
293 ###########################
294 # Assembler optimizations #
295 ###########################
297 AC_MSG_CHECKING([if assembler optimizations should be used])
298 AC_ARG_ENABLE([assembler], AS_HELP_STRING([--disable-assembler],
299 [Do not use assembler optimizations even if such exist
300 for the architecture.]),
301 [], [enable_assembler=yes])
302 if test "x$enable_assembler" = xyes; then
305 # Darwin should work too but only if not creating universal
306 # binaries. Solaris x86 could work too but I cannot test.
307 linux* | *bsd* | mingw* | cygwin | msys | *djgpp*)
309 i?86) enable_assembler=x86 ;;
310 x86_64) enable_assembler=x86_64 ;;
315 case $enable_assembler in
317 AC_MSG_RESULT([$enable_assembler])
321 AC_MSG_ERROR([--enable-assembler accepts only `yes', `no', `x86', or `x86_64'.])
324 AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
325 AM_CONDITIONAL(COND_ASM_X86_64, test "x$enable_assembler" = xx86_64)
328 #####################
329 # Size optimization #
330 #####################
332 AC_MSG_CHECKING([if small size is preferred over speed])
333 AC_ARG_ENABLE([small], AS_HELP_STRING([--enable-small],
334 [Make liblzma smaller and a little slower.
335 This is disabled by default to optimize for speed.]),
336 [], [enable_small=no])
337 if test "x$enable_small" = xyes; then
338 AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
339 elif test "x$enable_small" != xno; then
341 AC_MSG_ERROR([--enable-small accepts only `yes' or `no'])
343 AC_MSG_RESULT([$enable_small])
344 AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
351 AC_MSG_CHECKING([if threading support is wanted])
352 AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD],
353 [Supported METHODS are `yes', `no', `posix', `win95', and
354 `vista'. The default is `yes'. Using `no' together with
355 --enable-small makes liblzma thread unsafe.]),
356 [], [enable_threads=yes])
358 if test "x$enable_threads" = xyes; then
362 i?86) enable_threads=win95 ;;
363 *) enable_threads=vista ;;
372 case $enable_threads in
373 posix | win95 | vista)
374 AC_MSG_RESULT([yes, $enable_threads])
381 AC_MSG_ERROR([--enable-threads only accepts `yes', `no', `posix', `win95', or `vista'])
385 # The Win95 threading lacks thread-safe one-time initialization function.
386 # It's better to disallow it instead of allowing threaded but thread-unsafe
388 if test "x$enable_small$enable_threads" = xyeswin95; then
389 AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be
390 used at the same time])
393 # We use the actual result a little later.
396 #########################
397 # Assumed amount of RAM #
398 #########################
400 # We use 128 MiB as default, because it will allow decompressing files
401 # created with "xz -9". It would be slightly safer to guess a lower value,
402 # but most systems, on which we don't have any way to determine the amount
403 # of RAM, will probably have at least 128 MiB of RAM.
404 AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
405 AC_ARG_ENABLE([assume-ram], AS_HELP_STRING([--enable-assume-ram=SIZE],
406 [If and only if the real amount of RAM cannot be determined,
407 assume SIZE MiB. The default is 128 MiB. This affects the
408 default memory usage limit.]),
409 [], [enable_assume_ram=128])
410 assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789`
411 if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then
413 AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument])
415 AC_MSG_RESULT([$enable_assume_ram MiB])
416 AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
417 [How many MiB of RAM to assume if the real amount cannot
421 #########################
422 # Components to install #
423 #########################
425 AC_ARG_ENABLE([xz], [AS_HELP_STRING([--disable-xz],
426 [do not build the xz tool])],
428 AM_CONDITIONAL([COND_XZ], [test x$enable_xz != xno])
430 AC_ARG_ENABLE([xzdec], [AS_HELP_STRING([--disable-xzdec],
431 [do not build xzdec])],
432 [], [enable_xzdec=yes])
433 test "x$enable_decoders" = xno && enable_xzdec=no
434 AM_CONDITIONAL([COND_XZDEC], [test x$enable_xzdec != xno])
436 AC_ARG_ENABLE([lzmadec], [AS_HELP_STRING([--disable-lzmadec],
437 [do not build lzmadec
438 (it exists primarily for LZMA Utils compatibility)])],
439 [], [enable_lzmadec=yes])
440 test "x$enable_decoder_lzma1" = xno && enable_lzmadec=no
441 AM_CONDITIONAL([COND_LZMADEC], [test x$enable_lzmadec != xno])
443 AC_ARG_ENABLE([lzmainfo], [AS_HELP_STRING([--disable-lzmainfo],
444 [do not build lzmainfo
445 (it exists primarily for LZMA Utils compatibility)])],
446 [], [enable_lzmainfo=yes])
447 test "x$enable_decoder_lzma1" = xno && enable_lzmainfo=no
448 AM_CONDITIONAL([COND_LZMAINFO], [test x$enable_lzmainfo != xno])
450 AC_ARG_ENABLE([lzma-links], [AS_HELP_STRING([--disable-lzma-links],
451 [do not create symlinks for LZMA Utils compatibility])],
452 [], [enable_lzma_links=yes])
453 AM_CONDITIONAL([COND_LZMALINKS], [test x$enable_lzma_links != xno])
455 AC_ARG_ENABLE([scripts], [AS_HELP_STRING([--disable-scripts],
456 [do not install the scripts xzdiff, xzgrep, xzless, xzmore,
457 and their symlinks])],
458 [], [enable_scripts=yes])
459 AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
461 AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc],
462 [do not install documentation files to docdir
463 (man pages will still be installed)])],
464 [], [enable_doc=yes])
465 AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
468 #####################
469 # Symbol versioning #
470 #####################
472 AC_MSG_CHECKING([if library symbol versioning should be used])
473 AC_ARG_ENABLE([symbol-versions], [AS_HELP_STRING([--enable-symbol-versions],
474 [Use symbol versioning for liblzma. Enabled by default on
475 GNU/Linux, other GNU-based systems, and FreeBSD.])],
476 [], [enable_symbol_versions=auto])
477 if test "x$enable_symbol_versions" = xauto; then
479 # NOTE: Even if one omits -gnu on GNU/Linux (e.g.
480 # i486-slackware-linux), configure will (via config.sub)
481 # append -gnu (e.g. i486-slackware-linux-gnu), and this
482 # test will work correctly.
483 gnu* | *-gnu* | freebsd*)
484 enable_symbol_versions=yes
487 enable_symbol_versions=no
491 AC_MSG_RESULT([$enable_symbol_versions])
492 AM_CONDITIONAL([COND_SYMVERS], [test "x$enable_symbol_versions" = xyes])
499 AC_MSG_CHECKING([if sandboxing should be used])
500 AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD],
501 [This is an experimental feature.
502 Sandboxing METHOD can be `auto', `no', or `capsicum'.
503 The default is `no'.])],
504 [], [enable_sandbox=no])
505 case $enable_sandbox in
507 AC_MSG_RESULT([maybe (autodetect)])
510 AC_MSG_RESULT([$enable_sandbox])
514 AC_MSG_ERROR([--enable-sandbox only accepts `auto', `no', or `capsicum'.])
519 ###############################################################################
520 # Checks for programs.
521 ###############################################################################
525 if test -z "$POSIX_SHELL" && test "x$enable_scripts" = xyes ; then
526 AC_MSG_ERROR([No POSIX conforming shell (sh) was found.])
530 echo "Initializing Automake:"
532 # We don't use "subdir-objects" yet because it breaks "make distclean" when
533 # dependencies are enabled (as of Automake 1.14.1) due to this bug:
534 # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17354
535 # The -Wno-unsupported is used to silence warnings about missing
537 AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 serial-tests -Wno-unsupported])
541 if test x$ac_cv_prog_cc_c99 = xno ; then
542 AC_MSG_ERROR([No C99 compiler was found.])
547 AC_USE_SYSTEM_EXTENSIONS
549 case $enable_threads in
552 echo "POSIX threading support:"
553 AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
554 LIBS="$LIBS $PTHREAD_LIBS"
555 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
557 dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX,
558 dnl but it's tricky to get it right together with
559 dnl AC_PROG_CC_C99. Thus, this is handled by telling the
560 dnl user in INSTALL to set the correct CC manually.
562 AC_DEFINE([MYTHREAD_POSIX], [1],
563 [Define to 1 when using POSIX threads (pthreads).])
565 # These are nice to have but not mandatory.
567 # FIXME: xz uses clock_gettime if it is available and can do
568 # it even when threading is disabled. Moving this outside
569 # of pthread detection may be undesirable because then
570 # liblzma may get linked against librt even when librt isn't
573 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
574 AC_SEARCH_LIBS([clock_gettime], [rt])
575 AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
576 AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
580 AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using
581 Windows 95 (and thus XP) compatible threads.
582 This avoids use of features that were added in
586 AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using
587 Windows Vista compatible threads. This uses
588 features that are not available on Windows XP.])
591 AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno])
594 echo "Initializing Libtool:"
597 LT_LANG([Windows Resource])
599 # This is a bit wrong since it is possible to request that only some libs
600 # are built as shared. Using that feature isn't so common though, and this
601 # breaks only on Windows (at least for now) if the user enables only some
603 AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
606 ###############################################################################
607 # Checks for libraries.
608 ###############################################################################
611 echo "Initializing gettext:"
612 AM_GNU_GETTEXT_VERSION([0.19])
613 AM_GNU_GETTEXT([external])
616 ###############################################################################
617 # Checks for header files.
618 ###############################################################################
621 echo "System headers and functions:"
623 # There is currently no workarounds in this package if some of
624 # these headers are missing.
625 AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h],
627 [AC_MSG_ERROR([Required header file(s) are missing.])])
629 # This allows the use of the intrinsic functions if they are available.
630 AC_CHECK_HEADERS([immintrin.h])
633 ###############################################################################
634 # Checks for typedefs, structures, and compiler characteristics.
635 ###############################################################################
637 dnl We don't need these as long as we need a C99 compiler anyway.
651 AC_CHECK_SIZEOF([size_t])
653 # The command line tool can copy high resolution timestamps if such
654 # information is available in struct stat. Otherwise one second accuracy
657 struct stat.st_atim.tv_nsec,
658 struct stat.st_atimespec.tv_nsec,
659 struct stat.st_atimensec,
660 struct stat.st_uatime,
661 struct stat.st_atim.st__tim.tv_nsec])
667 ###############################################################################
668 # Checks for library functions.
669 ###############################################################################
671 # Gnulib replacements as needed
674 # Find the best function to set timestamps.
675 AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break])
677 # This is nice to have but not mandatory.
678 AC_CHECK_FUNCS([posix_fadvise])
686 # If requsted, check for system-provided SHA-256. At least the following
687 # implementations are supported:
689 # OS Headers Library Type Function
690 # FreeBSD sys/types.h + sha256.h libmd SHA256_CTX SHA256_Init
691 # NetBSD sys/types.h + sha2.h SHA256_CTX SHA256_Init
692 # OpenBSD sys/types.h + sha2.h SHA2_CTX SHA256Init
693 # Solaris sys/types.h + sha2.h libmd SHA256_CTX SHA256Init
694 # MINIX 3 sys/types.h + sha2.h SHA256_CTX SHA256_Init
695 # Darwin CommonCrypto/CommonDigest.h CC_SHA256_CTX CC_SHA256_Init
697 # Note that Darwin's CC_SHA256_Update takes buffer size as uint32_t instead
700 sha256_header_found=no
703 if test "x$enable_external_sha256" = "xyes"; then
704 # Test for Common Crypto before others, because Darwin has sha256.h
705 # too and we don't want to use that, because on older versions it
706 # uses OpenSSL functions, whose SHA256_Init is not guaranteed to
709 [CommonCrypto/CommonDigest.h sha256.h sha2.h],
710 [sha256_header_found=yes ; break])
711 if test "x$sha256_header_found" = xyes; then
712 AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX],
713 [sha256_type_found=yes], [],
714 [[#ifdef HAVE_SYS_TYPES_H
715 # include <sys/types.h>
717 #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
718 # include <CommonCrypto/CommonDigest.h>
726 if test "x$sha256_type_found" = xyes ; then
727 AC_SEARCH_LIBS([SHA256Init], [md])
728 AC_SEARCH_LIBS([SHA256_Init], [md])
729 AC_CHECK_FUNCS([CC_SHA256_Init SHA256Init SHA256_Init],
730 [sha256_func_found=yes ; break])
734 AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno])
735 if test "x$enable_external_sha256$sha256_func_found" = xyesno; then
736 AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found])
739 # Check for SSE2 intrinsics.
740 AC_CHECK_DECL([_mm_movemask_epi8],
741 [AC_DEFINE([HAVE__MM_MOVEMASK_EPI8], [1],
742 [Define to 1 if _mm_movemask_epi8 is available.])],
744 [#ifdef HAVE_IMMINTRIN_H
745 #include <immintrin.h>
748 # Check for sandbox support. If one is found, set enable_sandbox=found.
749 case $enable_sandbox in
751 AX_CHECK_CAPSICUM([enable_sandbox=found], [:])
755 # If a specific sandboxing method was explicitly requested and it wasn't
756 # found, give an error.
757 case $enable_sandbox in
761 AC_MSG_ERROR([$enable_sandbox support not found])
766 ###############################################################################
767 # If using GCC, set some additional AM_CFLAGS:
768 ###############################################################################
770 if test "$GCC" = yes ; then
772 echo "GCC extensions:"
775 # Always do the visibility check but don't set AM_CFLAGS on Windows.
776 # This way things get set properly even on Windows.
778 if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
779 AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
782 if test "$GCC" = yes ; then
783 # Enable as much warnings as possible. These commented warnings won't
784 # work for this package though:
785 # * -Wunreachable-code breaks several assert(0) cases, which are
786 # backed up with "return LZMA_PROG_ERROR".
787 # * -Wcast-qual would break various things where we need a non-const
788 # pointer although we don't modify anything through it.
789 # * -Wcast-align breaks optimized CRC32 and CRC64 implementation
790 # on some architectures (not on x86), where this warning is bogus,
791 # because we take care of correct alignment.
792 # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
793 # don't seem so useful here; at least the last one gives some
794 # warnings which are not bugs.
801 -Wmissing-include-dirs \
807 -Wbad-function-cast \
811 -Wstrict-prototypes \
812 -Wold-style-definition \
813 -Wmissing-prototypes \
814 -Wmissing-declarations \
818 AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
820 CFLAGS="$CFLAGS $NEW_FLAG -Werror"
821 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
822 [void foo(void); void foo(void) { }])], [
823 AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
831 AC_ARG_ENABLE([werror],
832 AS_HELP_STRING([--enable-werror], [Enable -Werror to abort
833 compilation on all compiler warnings.]),
834 [], [enable_werror=no])
835 if test "x$enable_werror" = "xyes"; then
836 AM_CFLAGS="$AM_CFLAGS -Werror"
841 ###############################################################################
842 # Create the makefiles and config.h
843 ###############################################################################
847 # Don't build the lib directory at all if we don't need any replacement
849 AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS")
851 # Add default AM_CFLAGS.
852 AC_SUBST([AM_CFLAGS])
854 # This is needed for src/scripts.
855 xz=`echo xz | sed "$program_transform_name"`
865 src/liblzma/api/Makefile
868 src/lzmainfo/Makefile
873 AC_CONFIG_FILES([src/scripts/xzdiff], [chmod +x src/scripts/xzdiff])
874 AC_CONFIG_FILES([src/scripts/xzgrep], [chmod +x src/scripts/xzgrep])
875 AC_CONFIG_FILES([src/scripts/xzmore], [chmod +x src/scripts/xzmore])
876 AC_CONFIG_FILES([src/scripts/xzless], [chmod +x src/scripts/xzless])
881 if test x$tuklib_cv_physmem_method = xunknown; then
884 echo "No supported method to detect the amount of RAM."
885 echo "Consider using --enable-assume-ram (if you didn't already)"
886 echo "or make a patch to add support for this operating system."
889 if test x$tuklib_cv_cpucores_method = xunknown; then
892 echo "No supported method to detect the number of CPU cores."
895 if test "x$enable_threads$enable_small" = xnoyes; then
898 echo "liblzma will be thread unsafe due the combination"
899 echo "of --disable-threads --enable-small."