2 # SPDX-License-Identifier: 0BSD
4 ###############################################################################
6 # Process this file with autoconf to produce a configure script.
10 ###############################################################################
12 # NOTE: Don't add useless checks. autoscan detects this and that, but don't
13 # let it confuse you. For example, we don't care about checking for behavior
14 # of malloc(), stat(), or lstat(), since we don't use those functions in
15 # a way that would cause the problems the autoconf macros check.
19 AC_INIT([XZ Utils], m4_esyscmd([/bin/sh build-aux/version.sh]),
20 [xz@tukaani.org], [xz], [https://tukaani.org/xz/])
21 AC_CONFIG_SRCDIR([src/liblzma/common/common.h])
22 AC_CONFIG_AUX_DIR([build-aux])
23 AC_CONFIG_MACRO_DIR([m4])
24 AC_CONFIG_HEADERS([config.h])
27 echo "$PACKAGE_STRING"
31 # This is needed to know if assembler optimizations can be used.
34 # We do some special things on Windows (32-bit or 64-bit) builds.
36 mingw* | cygwin | msys) is_w32=yes ;;
39 AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
41 # We need to use $EXEEXT with $(LN_S) when creating symlinks to
42 # executables. Cygwin is an exception to this, since it is recommended
43 # that symlinks don't have the .exe suffix. To make this work, we
46 # MSYS2 is treated the same way as Cygwin. It uses plain "msys" like
47 # the original MSYS when building MSYS/MSYS2-binaries. Hopefully this
48 # doesn't break things for the original MSYS developers. Note that this
49 # doesn't affect normal MSYS/MSYS2 users building non-MSYS/MSYS2 binaries
50 # since in that case the $host_os is usually mingw32.
52 cygwin | msys) LN_EXEEXT= ;;
53 *) LN_EXEEXT='$(EXEEXT)' ;;
58 echo "Configure options:"
66 AC_MSG_CHECKING([if debugging code should be compiled])
67 AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debugging code.]),
69 if test "x$enable_debug" = xyes; then
72 AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debugging code.])
81 m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv])dnl
82 m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv])
83 m4_define([LZ_FILTERS], [lzma1,lzma2])
85 m4_foreach([NAME], [SUPPORTED_FILTERS],
86 [enable_filter_[]NAME=no
87 enable_encoder_[]NAME=no
88 enable_decoder_[]NAME=no
91 AC_MSG_CHECKING([which encoders to build])
92 AC_ARG_ENABLE([encoders], AS_HELP_STRING([--enable-encoders=LIST],
93 [Comma-separated list of encoders to build. Default=all.
95 m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])),
96 [], [enable_encoders=SUPPORTED_FILTERS])
97 enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'`
98 if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then
100 AC_MSG_RESULT([(none)])
102 for arg in $enable_encoders
104 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
106 enable_filter_[]NAME=yes
107 enable_encoder_[]NAME=yes
108 AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1],
109 [Define to 1 if] NAME [encoder is enabled.])
113 AC_MSG_ERROR([unknown filter: $arg])
117 AC_DEFINE([HAVE_ENCODERS], [1],
118 [Define to 1 if any of HAVE_ENCODER_foo have been defined.])
119 AC_MSG_RESULT([$enable_encoders])
122 AC_MSG_CHECKING([which decoders to build])
123 AC_ARG_ENABLE([decoders], AS_HELP_STRING([--enable-decoders=LIST],
124 [Comma-separated list of decoders to build. Default=all.
125 Available decoders are the same as available encoders.]),
126 [], [enable_decoders=SUPPORTED_FILTERS])
127 enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'`
128 if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then
130 AC_MSG_RESULT([(none)])
132 for arg in $enable_decoders
134 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
136 enable_filter_[]NAME=yes
137 enable_decoder_[]NAME=yes
138 AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1],
139 [Define to 1 if] NAME [decoder is enabled.])
143 AC_MSG_ERROR([unknown filter: $arg])
147 AC_DEFINE([HAVE_DECODERS], [1],
148 [Define to 1 if any of HAVE_DECODER_foo have been defined.])
149 AC_MSG_RESULT([$enable_decoders])
152 if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \
153 || test "x$enable_decoder_lzma2$enable_decoder_lzma1" = xyesno; then
154 AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.])
157 AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno)
158 AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno)
160 m4_foreach([NAME], [SUPPORTED_FILTERS],
161 [AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes)
162 AM_CONDITIONAL(COND_ENCODER_[]m4_toupper(NAME), test "x$enable_encoder_[]NAME" = xyes)
163 AM_CONDITIONAL(COND_DECODER_[]m4_toupper(NAME), test "x$enable_decoder_[]NAME" = xyes)
166 # The so called "simple filters" share common code.
167 enable_filter_simple=no
168 enable_encoder_simple=no
169 enable_decoder_simple=no
170 m4_foreach([NAME], [SIMPLE_FILTERS],
171 [test "x$enable_filter_[]NAME" = xyes && enable_filter_simple=yes
172 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_simple=yes
173 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_simple=yes
175 AM_CONDITIONAL(COND_FILTER_SIMPLE, test "x$enable_filter_simple" = xyes)
176 AM_CONDITIONAL(COND_ENCODER_SIMPLE, test "x$enable_encoder_simple" = xyes)
177 AM_CONDITIONAL(COND_DECODER_SIMPLE, test "x$enable_decoder_simple" = xyes)
179 # LZ-based filters share common code.
183 m4_foreach([NAME], [LZ_FILTERS],
184 [test "x$enable_filter_[]NAME" = xyes && enable_filter_lz=yes
185 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_lz=yes
186 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_lz=yes
188 AM_CONDITIONAL(COND_FILTER_LZ, test "x$enable_filter_lz" = xyes)
189 AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes)
190 AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes)
197 m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4])
199 m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS],
200 [enable_match_finder_[]NAME=no
203 AC_MSG_CHECKING([which match finders to build])
204 AC_ARG_ENABLE([match-finders], AS_HELP_STRING([--enable-match-finders=LIST],
205 [Comma-separated list of match finders to build. Default=all.
206 At least one match finder is required for encoding with
207 the LZMA1 and LZMA2 filters. Available match finders:]
208 m4_translit(m4_defn([SUPPORTED_MATCH_FINDERS]), [,], [ ])), [],
209 [enable_match_finders=SUPPORTED_MATCH_FINDERS])
210 enable_match_finders=`echo "$enable_match_finders" | sed 's/,/ /g'`
211 if test "x$enable_encoder_lz" = xyes ; then
212 if test -z "$enable_match_finders"; then
213 AC_MSG_ERROR([At least one match finder is required for an LZ-based encoder.])
216 for arg in $enable_match_finders
218 case $arg in m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [
220 enable_match_finder_[]NAME=yes
221 AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1],
222 [Define to 1 to enable] NAME [match finder.])
226 AC_MSG_ERROR([unknown match finder: $arg])
230 AC_MSG_RESULT([$enable_match_finders])
232 AC_MSG_RESULT([(none because not building any LZ-based encoder)])
240 m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256])
242 m4_foreach([NAME], [SUPPORTED_CHECKS],
243 [enable_check_[]NAME=no
246 AC_MSG_CHECKING([which integrity checks to build])
247 AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks=LIST],
248 [Comma-separated list of integrity checks to build.
249 Default=all. Available integrity checks:]
250 m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])),
251 [], [enable_checks=SUPPORTED_CHECKS])
252 enable_checks=`echo "$enable_checks" | sed 's/,/ /g'`
253 if test "x$enable_checks" = xno || test "x$enable_checks" = x; then
254 AC_MSG_RESULT([(none)])
256 for arg in $enable_checks
258 case $arg in m4_foreach([NAME], [SUPPORTED_CHECKS], [
260 enable_check_[]NAME=yes
261 AC_DEFINE(HAVE_CHECK_[]m4_toupper(NAME), [1],
262 [Define to 1 if] NAME
263 [integrity check is enabled.])
267 AC_MSG_ERROR([unknown integrity check: $arg])
271 AC_MSG_RESULT([$enable_checks])
273 if test "x$enable_check_crc32" = xno ; then
274 AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
277 m4_foreach([NAME], [SUPPORTED_CHECKS],
278 [AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes)
281 AC_MSG_CHECKING([if external SHA-256 should be used])
282 AC_ARG_ENABLE([external-sha256], AS_HELP_STRING([--enable-external-sha256],
283 [Use SHA-256 code from the operating system.
284 See INSTALL for possible subtle problems.]),
285 [], [enable_external_sha256=no])
286 if test "x$enable_check_sha256" != "xyes"; then
287 enable_external_sha256=no
289 if test "x$enable_external_sha256" = xyes; then
300 AC_MSG_CHECKING([if MicroLZMA support should be built])
301 AC_ARG_ENABLE([microlzma], AS_HELP_STRING([--disable-microlzma],
302 [Do not build MicroLZMA encoder and decoder.
303 It is needed by specific applications only,
304 for example, erofs-utils.]),
305 [], [enable_microlzma=yes])
306 case $enable_microlzma in
308 AC_MSG_RESULT([$enable_microlzma])
312 AC_MSG_ERROR([--enable-microlzma accepts only 'yes' or 'no'.])
315 AM_CONDITIONAL(COND_MICROLZMA, test "x$enable_microlzma" = xyes)
318 #############################
319 # .lz (lzip) format support #
320 #############################
322 AC_MSG_CHECKING([if .lz (lzip) decompression support should be built])
323 AC_ARG_ENABLE([lzip-decoder], AS_HELP_STRING([--disable-lzip-decoder],
324 [Disable decompression support for .lz (lzip) files.]),
325 [], [enable_lzip_decoder=yes])
326 if test "x$enable_decoder_lzma1" != xyes; then
327 enable_lzip_decoder=no
328 AC_MSG_RESULT([no because LZMA1 decoder is disabled])
329 elif test "x$enable_lzip_decoder" = xyes; then
330 AC_DEFINE([HAVE_LZIP_DECODER], [1],
331 [Define to 1 if .lz (lzip) decompression support is enabled.])
336 AM_CONDITIONAL(COND_LZIP_DECODER, test "x$enable_lzip_decoder" = xyes)
339 ###########################
340 # Assembler optimizations #
341 ###########################
343 AC_MSG_CHECKING([if assembler optimizations should be used])
344 AC_ARG_ENABLE([assembler], AS_HELP_STRING([--disable-assembler],
345 [Do not use assembler optimizations even if such exist
346 for the architecture.]),
347 [], [enable_assembler=yes])
348 if test "x$enable_assembler" = xyes; then
351 # Darwin should work too but only if not creating universal
352 # binaries. Solaris x86 could work too but I cannot test.
353 linux* | *bsd* | mingw* | cygwin | msys | *djgpp*)
355 i?86) enable_assembler=x86 ;;
360 case $enable_assembler in
362 AC_DEFINE([HAVE_CRC_X86_ASM], [1], [Define to 1 if
363 the 32-bit x86 CRC assembly files are used.])
371 AC_MSG_ERROR([--enable-assembler accepts only 'yes', 'no', or 'x86' (32-bit).])
374 AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
381 AC_ARG_ENABLE([clmul-crc], AS_HELP_STRING([--disable-clmul-crc],
382 [Do not use carryless multiplication for CRC calculation
383 even if support for it is detected.]),
384 [], [enable_clmul_crc=yes])
387 ############################
388 # ARM64 CRC32 Instructions #
389 ############################
391 AC_ARG_ENABLE([arm64-crc32], AS_HELP_STRING([--disable-arm64-crc32],
392 [Do not use ARM64 CRC32 instructions even if support for it
394 [], [enable_arm64_crc32=yes])
397 ################################
398 # LoongArch CRC32 instructions #
399 ################################
401 AC_ARG_ENABLE([loongarch-crc32], AS_HELP_STRING([--disable-loongarch-crc32],
402 [Do not use LoongArch CRC32 instructions even if support for
404 [], [enable_loongarch_crc32=yes])
407 #####################
408 # Size optimization #
409 #####################
411 AC_MSG_CHECKING([if small size is preferred over speed])
412 AC_ARG_ENABLE([small], AS_HELP_STRING([--enable-small],
413 [Make liblzma smaller and a little slower.
414 This is disabled by default to optimize for speed.]),
415 [], [enable_small=no])
416 if test "x$enable_small" = xyes; then
417 AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
418 elif test "x$enable_small" != xno; then
420 AC_MSG_ERROR([--enable-small accepts only 'yes' or 'no'])
422 AC_MSG_RESULT([$enable_small])
423 AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
430 AC_MSG_CHECKING([if threading support is wanted])
431 AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD],
432 [Supported METHODS are 'yes', 'no', 'posix', 'win95', and
433 'vista'. The default is 'yes'. Using 'no' together with
434 --enable-small makes liblzma thread unsafe.]),
435 [], [enable_threads=yes])
437 if test "x$enable_threads" = xyes; then
441 i?86) enable_threads=win95 ;;
442 *) enable_threads=vista ;;
451 case $enable_threads in
452 posix | win95 | vista)
453 AC_MSG_RESULT([yes, $enable_threads])
460 AC_MSG_ERROR([--enable-threads only accepts 'yes', 'no', 'posix', 'win95', or 'vista'])
464 # We use the actual result a little later.
467 #########################
468 # Assumed amount of RAM #
469 #########################
471 # We use 128 MiB as default, because it will allow decompressing files
472 # created with "xz -9". It would be slightly safer to guess a lower value,
473 # but most systems, on which we don't have any way to determine the amount
474 # of RAM, will probably have at least 128 MiB of RAM.
475 AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
476 AC_ARG_ENABLE([assume-ram], AS_HELP_STRING([--enable-assume-ram=SIZE],
477 [If and only if the real amount of RAM cannot be determined,
478 assume SIZE MiB. The default is 128 MiB. This affects the
479 default memory usage limit.]),
480 [], [enable_assume_ram=128])
481 assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789`
482 if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then
484 AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument])
486 AC_MSG_RESULT([$enable_assume_ram MiB])
487 AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
488 [How many MiB of RAM to assume if the real amount cannot
492 #########################
493 # Components to install #
494 #########################
496 AC_ARG_ENABLE([xz], [AS_HELP_STRING([--disable-xz],
497 [do not build the xz tool])],
499 AM_CONDITIONAL([COND_XZ], [test x$enable_xz != xno])
501 AC_ARG_ENABLE([xzdec], [AS_HELP_STRING([--disable-xzdec],
502 [do not build xzdec])],
503 [], [enable_xzdec=yes])
504 test "x$enable_decoders" = xno && enable_xzdec=no
505 AM_CONDITIONAL([COND_XZDEC], [test x$enable_xzdec != xno])
507 AC_ARG_ENABLE([lzmadec], [AS_HELP_STRING([--disable-lzmadec],
508 [do not build lzmadec
509 (it exists primarily for LZMA Utils compatibility)])],
510 [], [enable_lzmadec=yes])
511 test "x$enable_decoder_lzma1" = xno && enable_lzmadec=no
512 AM_CONDITIONAL([COND_LZMADEC], [test x$enable_lzmadec != xno])
514 AC_ARG_ENABLE([lzmainfo], [AS_HELP_STRING([--disable-lzmainfo],
515 [do not build lzmainfo
516 (it exists primarily for LZMA Utils compatibility)])],
517 [], [enable_lzmainfo=yes])
518 test "x$enable_decoder_lzma1" = xno && enable_lzmainfo=no
519 AM_CONDITIONAL([COND_LZMAINFO], [test x$enable_lzmainfo != xno])
521 AC_ARG_ENABLE([lzma-links], [AS_HELP_STRING([--disable-lzma-links],
522 [do not create symlinks for LZMA Utils compatibility])],
523 [], [enable_lzma_links=yes])
524 AM_CONDITIONAL([COND_LZMALINKS], [test x$enable_lzma_links != xno])
526 AC_ARG_ENABLE([scripts], [AS_HELP_STRING([--disable-scripts],
527 [do not install the scripts xzdiff, xzgrep, xzless, xzmore,
528 and their symlinks])],
529 [], [enable_scripts=yes])
530 AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
532 AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc],
533 [do not install documentation files to docdir
534 (man pages are still installed and,
535 if --enable-doxygen is used,
536 liblzma API documentation is installed too)])],
537 [], [enable_doc=yes])
538 AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
540 AC_ARG_ENABLE([doxygen], [AS_HELP_STRING([--enable-doxygen],
541 [generate HTML version of the liblzma API documentation
542 using Doxygen and install the result to docdir])],
543 [], [enable_doxygen=no])
544 AM_CONDITIONAL([COND_DOXYGEN], [test x$enable_doxygen != xno])
551 AC_MSG_CHECKING([if sandboxing should be used])
552 AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD],
553 [Sandboxing METHOD can be
554 'auto', 'no', 'capsicum', 'pledge', or 'landlock'.
555 The default is 'auto' which enables sandboxing if
556 a supported sandboxing method is found.])],
557 [], [enable_sandbox=auto])
558 case $enable_xzdec-$enable_xz-$enable_sandbox in
561 AC_MSG_RESULT([no, --disable-xz and --disable-xzdec was used])
564 AC_MSG_RESULT([maybe (autodetect)])
566 *-*-no | *-*-capsicum | *-*-pledge | *-*-landlock)
567 AC_MSG_RESULT([$enable_sandbox])
571 AC_MSG_ERROR([--enable-sandbox only accepts 'auto', 'no', 'capsicum', 'pledge', or 'landlock'.])
576 ###########################
577 # PATH prefix for scripts #
578 ###########################
580 # The scripts can add a prefix to the search PATH so that POSIX tools
581 # or the xz binary is always in the PATH.
582 AC_ARG_ENABLE([path-for-scripts],
583 [AS_HELP_STRING([--enable-path-for-scripts=PREFIX],
584 [If PREFIX isn't empty, PATH=PREFIX:$PATH will be set in
585 the beginning of the scripts (xzgrep and others).
586 The default is empty except on Solaris the default is
590 solaris*) enable_path_for_scripts=/usr/xpg4/bin ;;
591 *) enable_path_for_scripts= ;;
594 if test -n "$enable_path_for_scripts" && test "x$enable_path_for_scripts" != xno ; then
595 enable_path_for_scripts="PATH=$enable_path_for_scripts:\$PATH"
597 enable_path_for_scripts=
599 AC_SUBST([enable_path_for_scripts])
602 ###############################################################################
603 # Checks for programs.
604 ###############################################################################
609 # The gnulib POSIX shell macro below may pick a shell that
610 # doesn't work with xzgrep. Workaround by picking a shell
611 # that is known to work.
612 if test -z "$gl_cv_posix_shell" && test -x /usr/xpg4/bin/sh; then
613 gl_cv_posix_shell=/usr/xpg4/bin/sh
618 if test -z "$POSIX_SHELL" && test "x$enable_scripts" = xyes ; then
619 AC_MSG_ERROR([No POSIX conforming shell (sh) was found.])
623 echo "Initializing Automake:"
625 # We don't use "subdir-objects" yet because it breaks "make distclean" when
626 # dependencies are enabled (as of Automake 1.14.1) due to this bug:
627 # https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17354
628 # The -Wno-unsupported is used to silence warnings about missing
630 AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 -Wno-unsupported])
633 dnl # Autoconf >= 2.70 warns that AC_PROG_CC_C99 is obsolete. However,
634 dnl # we have to keep using AC_PROG_CC_C99 instead of AC_PROG_CC
635 dnl # as long as we try to be compatible with Autoconf 2.69.
637 if test x$ac_cv_prog_cc_c99 = xno ; then
638 AC_MSG_ERROR([No C99 compiler was found.])
643 AC_USE_SYSTEM_EXTENSIONS
645 AS_CASE([$enable_threads],
648 echo "POSIX threading support:"
649 AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
650 LIBS="$PTHREAD_LIBS $LIBS"
651 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
653 dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX,
654 dnl but it's tricky to get it right together with
655 dnl AC_PROG_CC_C99. Thus, this is handled by telling the
656 dnl user in INSTALL to set the correct CC manually.
658 AC_DEFINE([MYTHREAD_POSIX], [1],
659 [Define to 1 when using POSIX threads (pthreads).])
661 # This is nice to have but not mandatory.
663 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
664 AC_CHECK_FUNCS([pthread_condattr_setclock])
668 AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using
669 Windows 95 (and thus XP) compatible threads.
670 This avoids use of features that were added in
674 AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using
675 Windows Vista compatible threads. This uses
676 features that are not available on Windows XP.])
679 AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno])
682 echo "Initializing Libtool:"
685 LT_LANG([Windows Resource])
687 # This is a bit wrong since it is possible to request that only some libs
688 # are built as shared. Using that feature isn't so common though, and this
689 # breaks only on Windows (at least for now) if the user enables only some
691 AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
693 #####################
694 # Symbol versioning #
695 #####################
697 # NOTE: This checks if we are building shared or static library
698 # and if --with-pic or --without-pic was used. Thus this check
699 # must be after Libtool initialization.
700 AC_MSG_CHECKING([if library symbol versioning should be used])
701 AC_ARG_ENABLE([symbol-versions], [AS_HELP_STRING([--enable-symbol-versions],
702 [Use symbol versioning for liblzma. Enabled by default on
703 GNU/Linux, other GNU-based systems, and FreeBSD.])],
704 [], [enable_symbol_versions=auto])
705 if test "x$enable_symbol_versions" = xauto; then
707 # NOTE: Even if one omits -gnu on GNU/Linux (e.g.
708 # i486-slackware-linux), configure will (via config.sub)
709 # append -gnu (e.g. i486-slackware-linux-gnu), and this
710 # test will work correctly.
711 gnu* | *-gnu* | freebsd*)
712 enable_symbol_versions=yes
715 enable_symbol_versions=no
720 # There are two variants for symbol versioning.
721 # See src/liblzma/validate_map.sh for details.
723 # On GNU/Linux, extra symbols are added in the C code. These extra symbols
724 # must not be put into a static library as they can cause problems (and
725 # even if they didn't cause problems, they would be useless). On other
726 # systems symbol versioning may be used too but there is no problem as only
727 # a linker script is specified in src/liblzma/Makefile.am and that isn't
728 # used when creating a static library.
730 # Libtool always uses -DPIC when building shared libraries by default and
731 # doesn't use it for static libs by default. This can be overridden with
732 # --with-pic and --without-pic though. As long as neither --with-pic nor
733 # --without-pic is used then we can use #ifdef PIC to detect if the file is
734 # being built for a shared library.
735 AS_IF([test "x$enable_symbol_versions" = xno], [
736 enable_symbol_versions=no
738 ], [test "x$enable_shared" = xno], [
739 enable_symbol_versions=no
740 AC_MSG_RESULT([no (not building a shared library)])
742 # "yes" means that symbol version are to be used but we need to
743 # autodetect which variant to use.
744 if test "x$enable_symbol_versions" = xyes ; then
745 case "$host_cpu-$host_os" in
747 # GCC 12 on MicroBlaze doesn't support
748 # __symver__ attribute. It's simplest and
749 # safest to use the generic version on that
750 # platform since then only the linker script
751 # is needed. The RHEL/CentOS 7 compatibility
752 # symbols don't matter on MicroBlaze.
753 enable_symbol_versions=generic
756 # NVIDIA HPC Compiler doesn't support symbol
757 # versioning but the linker script can still
759 AC_EGREP_CPP([use_generic_symbol_versioning],
761 use_generic_symbol_versioning
763 [enable_symbol_versions=generic],
764 [enable_symbol_versions=linux])
767 enable_symbol_versions=generic
772 if test "x$enable_symbol_versions" = xlinux ; then
773 case "$pic_mode-$enable_static" in
775 # Use symvers if PIC is defined.
776 have_symbol_versions_linux=2
779 # Not building static library.
780 # Use symvers unconditionally.
781 have_symbol_versions_linux=1
786 On GNU/Linux, building both shared and static library at the same time
787 is not supported if --with-pic or --without-pic is used.
788 Use either --disable-shared or --disable-static to build one type
789 of library at a time. If both types are needed, build one at a time,
790 possibly picking only src/liblzma/.libs/liblzma.a from the static build.])
793 AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX],
794 [$have_symbol_versions_linux],
795 [Define to 1 to if GNU/Linux-specific details
796 are unconditionally wanted for symbol
797 versioning. Define to 2 to if these are wanted
798 only if also PIC is defined (allows building
799 both shared and static liblzma at the same
800 time with Libtool if neither --with-pic nor
801 --without-pic is used). This define must be
802 used together with liblzma_linux.map.])
803 elif test "x$enable_symbol_versions" != xgeneric ; then
805 AC_MSG_ERROR([unknown symbol versioning variant '$enable_symbol_versions'])
807 AC_MSG_RESULT([yes ($enable_symbol_versions)])
810 AM_CONDITIONAL([COND_SYMVERS_LINUX],
811 [test "x$enable_symbol_versions" = xlinux])
812 AM_CONDITIONAL([COND_SYMVERS_GENERIC],
813 [test "x$enable_symbol_versions" = xgeneric])
816 ###############################################################################
817 # Checks for libraries.
818 ###############################################################################
820 dnl Support for _REQUIRE_VERSION was added in gettext 0.19.6. If both
821 dnl _REQUIRE_VERSION and _VERSION are present, the _VERSION is ignored.
822 dnl We use both for compatibility with other programs in the Autotools family.
824 echo "Initializing gettext:"
825 AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
826 AM_GNU_GETTEXT_VERSION([0.19.6])
827 AM_GNU_GETTEXT([external])
829 # The command line tools use UTF-8 on native Windows. Non-ASCII characters
830 # display correctly only when using UCRT and gettext-runtime >= 0.23.1.
831 AS_CASE([$USE_NLS-$host_os],
833 AC_MSG_CHECKING([for UCRT and gettext-runtime >= 0.23.1])
834 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
835 #define WIN32_LEAN_AND_MEAN
843 #if LIBINTL_VERSION < 0x001701
844 #error "gettext-runtime < 0.23.1"
851 Translation support (--enable-nls) on native Windows requires
852 UCRT and gettext-runtime >= 0.23.1. Use --disable-nls to build
853 with MSVCRT or old gettext-runtime.])
859 ###############################################################################
860 # Checks for header files.
861 ###############################################################################
864 echo "System headers and functions:"
866 # immintrin.h allows the use of the intrinsic functions if they are available.
867 # cpuid.h may be used for detecting x86 processor features at runtime.
868 AC_CHECK_HEADERS([immintrin.h cpuid.h])
871 ###############################################################################
872 # Checks for typedefs, structures, and compiler characteristics.
873 ###############################################################################
885 AC_CHECK_SIZEOF([size_t])
887 # The command line tool can copy high resolution timestamps if such
888 # information is available in struct stat. Otherwise one second accuracy
891 struct stat.st_atim.tv_nsec,
892 struct stat.st_atimespec.tv_nsec,
893 struct stat.st_atimensec,
894 struct stat.st_uatime,
895 struct stat.st_atim.st__tim.tv_nsec])
900 # __attribute__((__constructor__)) can be used for one-time initializations.
901 # Use -Werror because some compilers accept unknown attributes and just
904 # FIXME? Unfortunately -Werror can cause trouble if CFLAGS contains options
905 # that produce warnings for unrelated reasons. For example, GCC and Clang
906 # support -Wunused-macros which will warn about "#define _GNU_SOURCE 1"
907 # which will be among the #defines that Autoconf inserts to the beginning of
908 # the test program. There seems to be no nice way to prevent Autoconf from
909 # inserting the any defines to the test program.
910 AC_MSG_CHECKING([if __attribute__((__constructor__)) can be used])
911 have_func_attribute_constructor=no
913 CFLAGS="$CFLAGS -Werror"
914 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
915 __attribute__((__constructor__))
916 static void my_constructor_func(void) { return; }
918 AC_DEFINE([HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR], [1],
919 [Define to 1 if __attribute__((__constructor__))
920 is supported for functions.])
921 have_func_attribute_constructor=yes
928 # The Win95 threading lacks a thread-safe one-time initialization function.
929 # The one-time initialization is needed for crc32_small.c and crc64_small.c
930 # create the CRC tables. So if small mode is enabled, the threading mode is
931 # win95, and the compiler does not support attribute constructor, then we
932 # would end up with a multithreaded build that is thread-unsafe. As a
933 # result this configuration is not allowed.
934 if test "x$enable_small$enable_threads$have_func_attribute_constructor" \
937 --enable-threads=win95 and --enable-small cannot be used
938 at the same time with a compiler that doesn't support
939 __attribute__((__constructor__))])
943 ###############################################################################
944 # Checks for library functions.
945 ###############################################################################
947 # Gnulib replacements as needed
950 # If clock_gettime() is available, liblzma with pthreads may use it, and
951 # xz may use it even when threading support is disabled. In XZ Utils 5.4.x
952 # and older, configure checked for clock_gettime() only when using pthreads.
953 # This way non-threaded builds of liblzma didn't get a useless dependency on
954 # librt which further had a dependency on libpthread. Avoiding these was
955 # useful when a small build was needed, for example, for initramfs use.
957 # The above reasoning is thoroughly obsolete: On GNU/Linux, librt hasn't
958 # been needed for clock_gettime() since glibc 2.17 (2012-12-25).
959 # Solaris 10 needs librt but Solaris 11 doesn't anymore.
960 AC_SEARCH_LIBS([clock_gettime], [rt])
961 AC_CHECK_FUNCS([clock_gettime])
962 AC_CHECK_DECL([CLOCK_MONOTONIC], [AC_DEFINE([HAVE_CLOCK_MONOTONIC], [1],
963 [Define to 1 if 'CLOCK_MONOTONIC' is declared in <time.h>.])], [],
964 [[#include <time.h>]])
966 # Find the best function to set timestamps.
967 AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break])
969 # This is nice to have but not mandatory.
970 AC_CHECK_FUNCS([posix_fadvise])
978 # If requested, check for system-provided SHA-256. At least the following
979 # implementations are supported:
981 # OS Headers Library Type Function
982 # FreeBSD sys/types.h + sha256.h libmd SHA256_CTX SHA256_Init
983 # NetBSD sys/types.h + sha2.h SHA256_CTX SHA256_Init
984 # OpenBSD sys/types.h + sha2.h SHA2_CTX SHA256Init
985 # Solaris sys/types.h + sha2.h libmd SHA256_CTX SHA256Init
986 # MINIX 3 sys/types.h + sha2.h SHA256_CTX SHA256_Init
987 # Darwin CommonCrypto/CommonDigest.h CC_SHA256_CTX CC_SHA256_Init
989 # Note that Darwin's CC_SHA256_Update takes buffer size as uint32_t instead
992 sha256_header_found=no
995 AS_IF([test "x$enable_external_sha256" = "xyes"], [
996 # Test for Common Crypto before others, because Darwin has sha256.h
997 # too and we don't want to use that, because on older versions it
998 # uses OpenSSL functions, whose SHA256_Init is not guaranteed to
1001 [CommonCrypto/CommonDigest.h sha256.h sha2.h],
1002 [sha256_header_found=yes ; break])
1003 if test "x$sha256_header_found" = xyes; then
1004 AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX],
1005 [sha256_type_found=yes], [],
1006 [[#ifdef HAVE_SYS_TYPES_H
1007 # include <sys/types.h>
1009 #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
1010 # include <CommonCrypto/CommonDigest.h>
1012 #ifdef HAVE_SHA256_H
1013 # include <sha256.h>
1018 if test "x$sha256_type_found" = xyes ; then
1019 AC_SEARCH_LIBS([SHA256Init], [md])
1020 AC_SEARCH_LIBS([SHA256_Init], [md])
1021 AC_CHECK_FUNCS([CC_SHA256_Init SHA256Init SHA256_Init],
1022 [sha256_func_found=yes ; break])
1026 AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno])
1027 if test "x$enable_external_sha256$sha256_func_found" = xyesno; then
1028 AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found])
1031 # Check for SSE2 intrinsics. There is no run-time detection for SSE2 so if
1032 # compiler options enable SSE2 then SSE2 support is required by the binaries.
1033 # The compile-time check for SSE2 is done with #ifdefs because some compilers
1034 # (ICC, MSVC) allow SSE2 intrinsics even when SSE2 isn't enabled.
1035 AC_CHECK_DECL([_mm_movemask_epi8],
1036 [AC_DEFINE([HAVE__MM_MOVEMASK_EPI8], [1],
1037 [Define to 1 if _mm_movemask_epi8 is available.])],
1039 [#ifdef HAVE_IMMINTRIN_H
1040 #include <immintrin.h>
1043 # For faster CRC on 32/64-bit x86 and E2K (see also crc64_fast.c):
1045 # - Check for the CLMUL intrinsic _mm_clmulepi64_si128 in <immintrin.h>.
1046 # Check also for _mm_set_epi64x for consistency with CMake build
1047 # where it's needed to disable CLMUL with VS2013.
1049 # - Check that __attribute__((__target__("ssse3,sse4.1,pclmul"))) works
1050 # together with _mm_clmulepi64_si128 from <immintrin.h>. The attribute
1051 # was added in GCC 4.4 but some GCC 4.x versions don't allow intrinsics
1052 # with it. Exception: it must be not be used with EDG-based compilers
1053 # like ICC and the compiler on E2K.
1055 # If everything above is supported, runtime detection will be used to keep the
1056 # binaries working on systems that don't support the required extensions.
1058 # NOTE: Use a check that links and not merely compiles to ensure that
1059 # missing intrinsics don't get accepted with compilers that allow
1060 # implicit function declarations.
1061 AC_MSG_CHECKING([if _mm_clmulepi64_si128 is usable])
1062 AS_IF([test "x$enable_clmul_crc" = xno], [
1063 AC_MSG_RESULT([no, --disable-clmul-crc was used])
1065 AC_LINK_IFELSE([AC_LANG_SOURCE([[
1066 #include <immintrin.h>
1068 // CLMUL works on older E2K instruction set but it is slow due to emulation.
1069 #if defined(__e2k__) && __iset__ < 6
1073 // Intel's old compiler (ICC) can define __GNUC__ but the attribute must not
1074 // be used with it. The new Clang-based ICX needs the attribute.
1075 // Checking for !defined(__EDG__) catches ICC and other EDG-based compilers.
1076 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
1077 __attribute__((__target__("ssse3,sse4.1,pclmul")))
1081 __m128i a = _mm_set_epi64x(1, 2);
1082 a = _mm_clmulepi64_si128(a, a, 0);
1086 AC_DEFINE([HAVE_USABLE_CLMUL], [1],
1087 [Define to 1 if _mm_set_epi64x and
1088 _mm_clmulepi64_si128 are usable.
1089 See configure.ac for details.])
1090 enable_clmul_crc=yes
1094 AC_MSG_RESULT([$enable_clmul_crc])
1097 # ARM64 C Language Extensions define CRC32 functions in arm_acle.h.
1098 # These are supported by at least GCC and Clang which both need
1099 # __attribute__((__target__("+crc"))), unless the needed compiler flags
1100 # are used to support the CRC instruction.
1101 AC_MSG_CHECKING([if ARM64 CRC32 instruction is usable])
1102 AS_IF([test "x$enable_arm64_crc32" = xno], [
1103 AC_MSG_RESULT([no, --disable-arm64-crc32 was used])
1105 AC_LINK_IFELSE([AC_LANG_SOURCE([[
1106 #include <arm_acle.h>
1109 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
1110 __attribute__((__target__("+crc")))
1114 return __crc32d(1, 2) != 0;
1117 AC_DEFINE([HAVE_ARM64_CRC32], [1],
1118 [Define to 1 if ARM64 CRC32 instruction is supported.
1119 See configure.ac for details.])
1120 enable_arm64_crc32=yes
1122 enable_arm64_crc32=no
1124 AC_MSG_RESULT([$enable_arm64_crc32])
1127 # Check for ARM64 CRC32 instruction runtime detection.
1129 # - getauxval() is supported on Linux.
1131 # - elf_aux_info() is supported on FreeBSD and OpenBSD >= 7.6.
1133 # - sysctlbyname("hw.optional.armv8_crc32", ...) is supported on Darwin
1134 # (macOS, iOS, etc.). Note that sysctlbyname() is supported on FreeBSD,
1135 # NetBSD, and possibly others too but the string is specific to Apple
1136 # OSes. The C code is responsible for checking defined(__APPLE__)
1137 # before using sysctlbyname("hw.optional.armv8_crc32", ...).
1139 AS_IF([test "x$enable_arm64_crc32" = xyes], [
1140 AC_CHECK_FUNCS([getauxval elf_aux_info sysctlbyname], [break])
1144 # LoongArch CRC32 intrinsics are in larchintrin.h.
1145 # These are supported by at least GCC and Clang.
1147 # Only 64-bit LoongArch is currently supported.
1148 # It doesn't need runtime detection.
1149 AC_MSG_CHECKING([if LoongArch CRC32 instructions are usable])
1150 AS_IF([test "x$enable_loongarch_crc32" = xno], [
1151 AC_MSG_RESULT([no, --disable-loongarch-crc32 was used])
1153 AC_LINK_IFELSE([AC_LANG_SOURCE([[
1154 #if !(defined(__loongarch__) && __loongarch_grlen >= 64)
1158 #include <larchintrin.h>
1161 return __crc_w_w_w(1, 2);
1164 AC_DEFINE([HAVE_LOONGARCH_CRC32], [1], [Define to 1 if
1165 64-bit LoongArch CRC32 instructions are supported.])
1166 enable_loongarch_crc32=yes
1168 enable_loongarch_crc32=no
1170 AC_MSG_RESULT([$enable_loongarch_crc32])
1174 # Check for sandbox support. If one is found, set enable_sandbox=found.
1176 # About -fsanitize: Of our three sandbox methods, only Landlock is
1177 # incompatible with -fsanitize. FreeBSD 13.2 with Capsicum was tested with
1178 # -fsanitize=address,undefined and had no issues. OpenBSD (as of version
1179 # 7.4) has minimal support for process instrumentation. OpenBSD does not
1180 # distribute the additional libraries needed (libasan, libubsan, etc.) with
1181 # GCC or Clang needed for runtime sanitization support and instead only
1182 # support -fsanitize-minimal-runtime for minimal undefined behavior
1183 # sanitization. This minimal support is compatible with our use of the
1184 # Pledge sandbox. So only Landlock will result in a build that cannot
1185 # compress or decompress a single file to standard out.
1186 AS_CASE([$enable_sandbox],
1187 [auto | capsicum], [
1188 AC_CHECK_FUNCS([cap_rights_limit], [enable_sandbox=found])
1191 AS_CASE([$enable_sandbox],
1193 AC_CHECK_FUNCS([pledge], [enable_sandbox=found])
1196 AS_CASE([$enable_sandbox],
1197 [auto | landlock], [
1198 AC_MSG_CHECKING([if Linux Landlock is usable])
1200 # A compile check is done here because some systems have
1201 # linux/landlock.h, but do not have the syscalls defined
1202 # in order to actually use Linux Landlock.
1203 AC_LINK_IFELSE([AC_LANG_SOURCE([[
1204 #include <linux/landlock.h>
1205 #include <sys/syscall.h>
1206 #include <sys/prctl.h>
1210 (void)prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
1211 (void)SYS_landlock_create_ruleset;
1212 (void)SYS_landlock_restrict_self;
1213 (void)LANDLOCK_CREATE_RULESET_VERSION;
1217 enable_sandbox=found
1219 AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
1220 CFLAGS contains '-fsanitize=' which is incompatible with the Landlock
1221 sandboxing. Use --disable-sandbox when using '-fsanitize'.])])
1223 AC_DEFINE([HAVE_LINUX_LANDLOCK], [1],
1224 [Define to 1 if Linux Landlock is supported.
1225 See configure.ac for details.])
1226 AC_MSG_RESULT([yes])
1233 # If a specific sandboxing method was explicitly requested and it wasn't
1234 # found, give an error.
1235 case $enable_sandbox in
1239 AC_MSG_ERROR([$enable_sandbox support not found])
1244 ###############################################################################
1245 # If using GCC, set some additional AM_CFLAGS:
1246 ###############################################################################
1248 if test "$GCC" = yes ; then
1250 echo "GCC extensions:"
1253 # Always do the visibility check but don't set AM_CFLAGS on Windows.
1254 # This way things get set properly even on Windows.
1256 if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
1257 AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
1260 AS_IF([test "$GCC" = yes], [
1261 # Enable as much warnings as possible. These commented warnings won't
1262 # work for this package though:
1263 # * -Wunreachable-code breaks several assert(0) cases, which are
1264 # backed up with "return LZMA_PROG_ERROR".
1265 # * -Wcast-qual would break various things where we need a non-const
1266 # pointer although we don't modify anything through it.
1267 # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
1268 # don't seem so useful here; at least the last one gives some
1269 # warnings which are not bugs.
1270 # * -Wconversion still shows too many warnings.
1272 # The flags before the empty line are for GCC and many of them
1273 # are supported by Clang too. The flags after the empty line are
1281 -Wmissing-include-dirs \
1282 -Wshift-overflow=2 \
1283 -Wstrict-overflow=3 \
1290 -Wbad-function-cast \
1294 -Wfloat-conversion \
1296 -Waggregate-return \
1297 -Wstrict-prototypes \
1298 -Wold-style-definition \
1299 -Wmissing-prototypes \
1300 -Wmissing-declarations \
1302 -Wimplicit-fallthrough \
1303 -Wimplicit-fallthrough=5 \
1310 -Warray-bounds-pointer-arithmetic \
1312 -Wconditional-uninitialized \
1315 -Wempty-translation-unit \
1316 -Wflexible-array-extensions \
1317 -Wmissing-variable-declarations \
1319 -Wshift-sign-overflow \
1322 AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
1323 OLD_CFLAGS="$CFLAGS"
1324 CFLAGS="$CFLAGS $NEW_FLAG -Werror"
1325 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1326 [[void foo(void); void foo(void) { }]])], [
1327 AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
1328 AC_MSG_RESULT([yes])
1332 CFLAGS="$OLD_CFLAGS"
1335 AC_ARG_ENABLE([werror],
1336 AS_HELP_STRING([--enable-werror], [Enable -Werror to abort
1337 compilation on all compiler warnings.]),
1338 [], [enable_werror=no])
1339 if test "x$enable_werror" = "xyes"; then
1340 AM_CFLAGS="$AM_CFLAGS -Werror"
1345 ###############################################################################
1346 # Create the makefiles and config.h
1347 ###############################################################################
1351 # Don't build the lib directory at all if we don't need any replacement
1353 AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS")
1355 # Add default AM_CFLAGS.
1356 AC_SUBST([AM_CFLAGS])
1358 # This is needed for src/scripts.
1359 xz=`echo xz | sed "$program_transform_name"`
1367 src/liblzma/Makefile
1368 src/liblzma/api/Makefile
1371 src/lzmainfo/Makefile
1372 src/scripts/Makefile
1376 AC_CONFIG_FILES([src/scripts/xzdiff], [chmod +x src/scripts/xzdiff])
1377 AC_CONFIG_FILES([src/scripts/xzgrep], [chmod +x src/scripts/xzgrep])
1378 AC_CONFIG_FILES([src/scripts/xzmore], [chmod +x src/scripts/xzmore])
1379 AC_CONFIG_FILES([src/scripts/xzless], [chmod +x src/scripts/xzless])
1384 if test x$tuklib_cv_physmem_method = xunknown; then
1387 echo "No supported method to detect the amount of RAM."
1388 echo "Consider using --enable-assume-ram (if you didn't already)"
1389 echo "or make a patch to add support for this operating system."
1392 if test x$tuklib_cv_cpucores_method = xunknown; then
1395 echo "No supported method to detect the number of CPU cores."
1398 if test "x$enable_threads$enable_small$have_func_attribute_constructor" \
1402 echo "liblzma will be thread-unsafe due to the combination"
1403 echo "of --disable-threads --enable-small when using a compiler"
1404 echo "that doesn't support __attribute__((__constructor__))."