2007-12-08 23:42:33 +01:00
|
|
|
# -*- Autoconf -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
2009-04-13 10:27:40 +02:00
|
|
|
# Author: Lasse Collin
|
2007-12-08 23:42:33 +01:00
|
|
|
#
|
2009-04-13 10:27:40 +02:00
|
|
|
# This file has been put into the public domain.
|
|
|
|
# You can do whatever you want with this file.
|
2007-12-08 23:42:33 +01:00
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# NOTE: Don't add useless checks. autoscan detects this and that, but don't
|
|
|
|
# let it confuse you. For example, we don't care about checking for behavior
|
|
|
|
# of malloc(), stat(), or lstat(), since we don't use those functions in
|
|
|
|
# a way that would cause the problems the autoconf macros check.
|
|
|
|
|
2020-02-15 14:07:11 +01:00
|
|
|
AC_PREREQ([2.69])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2010-09-28 09:59:53 +02:00
|
|
|
AC_INIT([XZ Utils], m4_esyscmd([/bin/sh build-aux/version.sh]),
|
2022-11-30 17:08:34 +01:00
|
|
|
[xz@tukaani.org], [xz], [https://tukaani.org/xz/])
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_CONFIG_SRCDIR([src/liblzma/common/common.h])
|
2009-07-18 17:54:55 +02:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
2009-03-01 08:00:06 +01:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2022-10-25 22:45:03 +02:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
echo
|
2008-12-12 23:54:11 +01:00
|
|
|
echo "$PACKAGE_STRING"
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "System type:"
|
|
|
|
# This is needed to know if assembler optimizations can be used.
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
|
2009-06-30 16:09:57 +02:00
|
|
|
# We do some special things on Windows (32-bit or 64-bit) builds.
|
|
|
|
case $host_os in
|
2015-08-11 12:23:04 +02:00
|
|
|
mingw* | cygwin | msys) is_w32=yes ;;
|
|
|
|
*) is_w32=no ;;
|
2009-06-30 16:09:57 +02:00
|
|
|
esac
|
|
|
|
AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
|
|
|
|
|
2009-09-11 09:24:09 +02:00
|
|
|
# We need to use $EXEEXT with $(LN_S) when creating symlinks to
|
|
|
|
# executables. Cygwin is an exception to this, since it is recommended
|
|
|
|
# that symlinks don't have the .exe suffix. To make this work, we
|
|
|
|
# define LN_EXEEXT.
|
2015-08-11 12:21:52 +02:00
|
|
|
#
|
|
|
|
# MSYS2 is treated the same way as Cygwin. It uses plain "msys" like
|
|
|
|
# the original MSYS when building MSYS/MSYS2-binaries. Hopefully this
|
|
|
|
# doesn't break things for the original MSYS developers. Note that this
|
|
|
|
# doesn't affect normal MSYS/MSYS2 users building non-MSYS/MSYS2 binaries
|
|
|
|
# since in that case the $host_os is usually mingw32.
|
2009-09-11 09:24:09 +02:00
|
|
|
case $host_os in
|
2015-08-11 12:21:52 +02:00
|
|
|
cygwin | msys) LN_EXEEXT= ;;
|
|
|
|
*) LN_EXEEXT='$(EXEEXT)' ;;
|
2009-09-11 09:24:09 +02:00
|
|
|
esac
|
|
|
|
AC_SUBST([LN_EXEEXT])
|
2008-08-28 21:53:15 +02:00
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
echo
|
|
|
|
echo "Configure options:"
|
2009-02-09 13:54:31 +01:00
|
|
|
AM_CFLAGS=
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
|
|
|
|
#############
|
|
|
|
# Debugging #
|
|
|
|
#############
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_CHECKING([if debugging code should be compiled])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debugging code.]),
|
2007-12-08 23:42:33 +01:00
|
|
|
[], enable_debug=no)
|
|
|
|
if test "x$enable_debug" = xyes; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
2008-12-30 23:57:27 +01:00
|
|
|
AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debugging code.])
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
|
|
|
|
###########
|
|
|
|
# Filters #
|
|
|
|
###########
|
|
|
|
|
2022-09-19 18:34:56 +02:00
|
|
|
m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc])dnl
|
|
|
|
m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,arm64,sparc])
|
2008-09-27 18:09:21 +02:00
|
|
|
m4_define([LZ_FILTERS], [lzma1,lzma2])
|
2008-08-28 21:53:15 +02:00
|
|
|
|
|
|
|
m4_foreach([NAME], [SUPPORTED_FILTERS],
|
|
|
|
[enable_filter_[]NAME=no
|
|
|
|
enable_encoder_[]NAME=no
|
|
|
|
enable_decoder_[]NAME=no
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([which encoders to build])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([encoders], AS_HELP_STRING([--enable-encoders=LIST],
|
2008-08-28 21:53:15 +02:00
|
|
|
[Comma-separated list of encoders to build. Default=all.
|
|
|
|
Available encoders:]
|
|
|
|
m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])),
|
|
|
|
[], [enable_encoders=SUPPORTED_FILTERS])
|
2010-05-26 08:55:47 +02:00
|
|
|
enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'`
|
2008-08-28 21:53:15 +02:00
|
|
|
if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then
|
2015-11-03 19:35:19 +01:00
|
|
|
enable_encoders=no
|
2008-08-28 21:53:15 +02:00
|
|
|
AC_MSG_RESULT([(none)])
|
2007-12-08 23:42:33 +01:00
|
|
|
else
|
2008-08-28 21:53:15 +02:00
|
|
|
for arg in $enable_encoders
|
2007-12-08 23:42:33 +01:00
|
|
|
do
|
2008-08-28 21:53:15 +02:00
|
|
|
case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
|
|
|
|
NAME)
|
|
|
|
enable_filter_[]NAME=yes
|
|
|
|
enable_encoder_[]NAME=yes
|
|
|
|
AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1],
|
|
|
|
[Define to 1 if] NAME [encoder is enabled.])
|
|
|
|
;;])
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_ERROR([unknown filter: $arg])
|
2007-12-08 23:42:33 +01:00
|
|
|
;;
|
2008-08-28 21:53:15 +02:00
|
|
|
esac
|
|
|
|
done
|
2015-11-03 19:29:33 +01:00
|
|
|
AC_DEFINE([HAVE_ENCODERS], [1],
|
|
|
|
[Define to 1 if any of HAVE_ENCODER_foo have been defined.])
|
2008-08-28 21:53:15 +02:00
|
|
|
AC_MSG_RESULT([$enable_encoders])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([which decoders to build])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([decoders], AS_HELP_STRING([--enable-decoders=LIST],
|
2008-08-28 21:53:15 +02:00
|
|
|
[Comma-separated list of decoders to build. Default=all.
|
|
|
|
Available decoders are the same as available encoders.]),
|
|
|
|
[], [enable_decoders=SUPPORTED_FILTERS])
|
2010-05-26 08:55:47 +02:00
|
|
|
enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'`
|
2008-08-28 21:53:15 +02:00
|
|
|
if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then
|
2015-11-03 19:35:19 +01:00
|
|
|
enable_decoders=no
|
2008-08-28 21:53:15 +02:00
|
|
|
AC_MSG_RESULT([(none)])
|
|
|
|
else
|
|
|
|
for arg in $enable_decoders
|
|
|
|
do
|
|
|
|
case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
|
|
|
|
NAME)
|
|
|
|
enable_filter_[]NAME=yes
|
|
|
|
enable_decoder_[]NAME=yes
|
|
|
|
AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1],
|
|
|
|
[Define to 1 if] NAME [decoder is enabled.])
|
|
|
|
;;])
|
2007-12-08 23:42:33 +01:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_ERROR([unknown filter: $arg])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2015-11-03 19:29:33 +01:00
|
|
|
AC_DEFINE([HAVE_DECODERS], [1],
|
|
|
|
[Define to 1 if any of HAVE_DECODER_foo have been defined.])
|
2008-08-28 21:53:15 +02:00
|
|
|
AC_MSG_RESULT([$enable_decoders])
|
2007-12-08 23:42:33 +01:00
|
|
|
fi
|
2008-08-28 21:53:15 +02:00
|
|
|
|
2008-09-27 18:09:21 +02:00
|
|
|
if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \
|
|
|
|
|| test "x$enable_decoder_lzma2$enable_decoder_lzma1" = xyesno; then
|
|
|
|
AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.])
|
2007-12-08 23:42:33 +01:00
|
|
|
fi
|
2008-08-28 21:53:15 +02:00
|
|
|
|
2015-11-03 19:35:19 +01:00
|
|
|
AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno)
|
|
|
|
AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno)
|
2009-05-02 13:46:50 +02:00
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
m4_foreach([NAME], [SUPPORTED_FILTERS],
|
|
|
|
[AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes)
|
|
|
|
AM_CONDITIONAL(COND_ENCODER_[]m4_toupper(NAME), test "x$enable_encoder_[]NAME" = xyes)
|
|
|
|
AM_CONDITIONAL(COND_DECODER_[]m4_toupper(NAME), test "x$enable_decoder_[]NAME" = xyes)
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
# The so called "simple filters" share common code.
|
|
|
|
enable_filter_simple=no
|
|
|
|
enable_encoder_simple=no
|
|
|
|
enable_decoder_simple=no
|
|
|
|
m4_foreach([NAME], [SIMPLE_FILTERS],
|
|
|
|
[test "x$enable_filter_[]NAME" = xyes && enable_filter_simple=yes
|
|
|
|
test "x$enable_encoder_[]NAME" = xyes && enable_encoder_simple=yes
|
|
|
|
test "x$enable_decoder_[]NAME" = xyes && enable_decoder_simple=yes
|
|
|
|
])dnl
|
|
|
|
AM_CONDITIONAL(COND_FILTER_SIMPLE, test "x$enable_filter_simple" = xyes)
|
|
|
|
AM_CONDITIONAL(COND_ENCODER_SIMPLE, test "x$enable_encoder_simple" = xyes)
|
|
|
|
AM_CONDITIONAL(COND_DECODER_SIMPLE, test "x$enable_decoder_simple" = xyes)
|
|
|
|
|
|
|
|
# LZ-based filters share common code.
|
|
|
|
enable_filter_lz=no
|
|
|
|
enable_encoder_lz=no
|
|
|
|
enable_decoder_lz=no
|
|
|
|
m4_foreach([NAME], [LZ_FILTERS],
|
|
|
|
[test "x$enable_filter_[]NAME" = xyes && enable_filter_lz=yes
|
|
|
|
test "x$enable_encoder_[]NAME" = xyes && enable_encoder_lz=yes
|
|
|
|
test "x$enable_decoder_[]NAME" = xyes && enable_decoder_lz=yes
|
|
|
|
])dnl
|
|
|
|
AM_CONDITIONAL(COND_FILTER_LZ, test "x$enable_filter_lz" = xyes)
|
|
|
|
AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes)
|
|
|
|
AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes)
|
|
|
|
|
|
|
|
|
|
|
|
#################
|
|
|
|
# Match finders #
|
|
|
|
#################
|
|
|
|
|
|
|
|
m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4])
|
|
|
|
|
|
|
|
m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS],
|
|
|
|
[enable_match_finder_[]NAME=no
|
|
|
|
])
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_CHECKING([which match finders to build])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([match-finders], AS_HELP_STRING([--enable-match-finders=LIST],
|
2007-12-08 23:42:33 +01:00
|
|
|
[Comma-separated list of match finders to build. Default=all.
|
|
|
|
At least one match finder is required for encoding with
|
2008-09-27 18:09:21 +02:00
|
|
|
the LZMA1 and LZMA2 filters. Available match finders:]
|
2008-08-28 21:53:15 +02:00
|
|
|
m4_translit(m4_defn([SUPPORTED_MATCH_FINDERS]), [,], [ ])), [],
|
|
|
|
[enable_match_finders=SUPPORTED_MATCH_FINDERS])
|
2007-12-08 23:42:33 +01:00
|
|
|
enable_match_finders=`echo "$enable_match_finders" | sed 's/,/ /g'`
|
2009-05-02 13:46:50 +02:00
|
|
|
if test "x$enable_encoder_lz" = xyes ; then
|
2022-07-25 17:20:01 +02:00
|
|
|
if test -z "$enable_match_finders"; then
|
|
|
|
AC_MSG_ERROR([At least one match finder is required for an LZ-based encoder.])
|
|
|
|
fi
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
for arg in $enable_match_finders
|
|
|
|
do
|
2008-08-28 21:53:15 +02:00
|
|
|
case $arg in m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [
|
|
|
|
NAME)
|
|
|
|
enable_match_finder_[]NAME=yes
|
|
|
|
AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1],
|
|
|
|
[Define to 1 to enable] NAME [match finder.])
|
|
|
|
;;])
|
2007-12-08 23:42:33 +01:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_ERROR([unknown match finder: $arg])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
AC_MSG_RESULT([$enable_match_finders])
|
|
|
|
else
|
2008-08-28 21:53:15 +02:00
|
|
|
AC_MSG_RESULT([(none because not building any LZ-based encoder)])
|
2007-12-08 23:42:33 +01:00
|
|
|
fi
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
|
|
|
|
####################
|
|
|
|
# Integrity checks #
|
|
|
|
####################
|
|
|
|
|
|
|
|
m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256])
|
|
|
|
|
2011-05-17 11:01:37 +02:00
|
|
|
m4_foreach([NAME], [SUPPORTED_CHECKS],
|
2008-08-28 21:53:15 +02:00
|
|
|
[enable_check_[]NAME=no
|
|
|
|
])dnl
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_CHECKING([which integrity checks to build])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks=LIST],
|
2007-12-08 23:42:33 +01:00
|
|
|
[Comma-separated list of integrity checks to build.
|
2008-08-28 21:53:15 +02:00
|
|
|
Default=all. Available integrity checks:]
|
|
|
|
m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])),
|
|
|
|
[], [enable_checks=SUPPORTED_CHECKS])
|
2007-12-08 23:42:33 +01:00
|
|
|
enable_checks=`echo "$enable_checks" | sed 's/,/ /g'`
|
|
|
|
if test "x$enable_checks" = xno || test "x$enable_checks" = x; then
|
|
|
|
AC_MSG_RESULT([(none)])
|
|
|
|
else
|
|
|
|
for arg in $enable_checks
|
|
|
|
do
|
2008-08-28 21:53:15 +02:00
|
|
|
case $arg in m4_foreach([NAME], [SUPPORTED_CHECKS], [
|
|
|
|
NAME)
|
|
|
|
enable_check_[]NAME=yes
|
|
|
|
AC_DEFINE(HAVE_CHECK_[]m4_toupper(NAME), [1],
|
|
|
|
[Define to 1 if] NAME
|
|
|
|
[integrity check is enabled.])
|
|
|
|
;;])
|
2007-12-08 23:42:33 +01:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_ERROR([unknown integrity check: $arg])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
AC_MSG_RESULT([$enable_checks])
|
|
|
|
fi
|
2013-07-15 13:08:02 +02:00
|
|
|
if test "x$enable_check_crc32" = xno ; then
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
|
|
|
|
fi
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
m4_foreach([NAME], [SUPPORTED_CHECKS],
|
|
|
|
[AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes)
|
|
|
|
])dnl
|
|
|
|
|
2016-03-13 19:21:49 +01:00
|
|
|
AC_MSG_CHECKING([if external SHA-256 should be used])
|
|
|
|
AC_ARG_ENABLE([external-sha256], AS_HELP_STRING([--enable-external-sha256],
|
|
|
|
[Use SHA-256 code from the operating system.
|
|
|
|
See INSTALL for possible subtle problems.]),
|
|
|
|
[], [enable_external_sha256=no])
|
|
|
|
if test "x$enable_check_sha256" != "xyes"; then
|
|
|
|
enable_external_sha256=no
|
|
|
|
fi
|
|
|
|
if test "x$enable_external_sha256" = xyes; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
|
2022-10-25 22:28:34 +02:00
|
|
|
#############
|
|
|
|
# MicroLZMA #
|
|
|
|
#############
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if MicroLZMA support should be built])
|
|
|
|
AC_ARG_ENABLE([microlzma], AS_HELP_STRING([--disable-microlzma],
|
|
|
|
[Do not build MicroLZMA encoder and decoder.
|
|
|
|
It is needed by specific applications only,
|
|
|
|
for example, erofs-utils.]),
|
|
|
|
[], [enable_microlzma=yes])
|
|
|
|
case $enable_microlzma in
|
|
|
|
yes | no)
|
|
|
|
AC_MSG_RESULT([$enable_microlzma])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
2023-09-24 16:09:16 +02:00
|
|
|
AC_MSG_ERROR([--enable-microlzma accepts only 'yes' or 'no'.])
|
2022-10-25 22:28:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AM_CONDITIONAL(COND_MICROLZMA, test "x$enable_microlzma" = xyes)
|
|
|
|
|
|
|
|
|
2022-10-06 14:50:20 +02:00
|
|
|
#############################
|
|
|
|
# .lz (lzip) format support #
|
|
|
|
#############################
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if .lz (lzip) decompression support should be built])
|
|
|
|
AC_ARG_ENABLE([lzip-decoder], AS_HELP_STRING([--disable-lzip-decoder],
|
|
|
|
[Disable decompression support for .lz (lzip) files.]),
|
|
|
|
[], [enable_lzip_decoder=yes])
|
|
|
|
if test "x$enable_decoder_lzma1" != xyes; then
|
|
|
|
enable_lzip_decoder=no
|
|
|
|
AC_MSG_RESULT([no because LZMA1 decoder is disabled])
|
|
|
|
elif test "x$enable_lzip_decoder" = xyes; then
|
|
|
|
AC_DEFINE([HAVE_LZIP_DECODER], [1],
|
|
|
|
[Define to 1 if .lz (lzip) decompression support is enabled.])
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
AM_CONDITIONAL(COND_LZIP_DECODER, test "x$enable_lzip_decoder" = xyes)
|
|
|
|
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
###########################
|
|
|
|
# Assembler optimizations #
|
|
|
|
###########################
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_CHECKING([if assembler optimizations should be used])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([assembler], AS_HELP_STRING([--disable-assembler],
|
2007-12-08 23:42:33 +01:00
|
|
|
[Do not use assembler optimizations even if such exist
|
|
|
|
for the architecture.]),
|
2008-06-18 17:02:10 +02:00
|
|
|
[], [enable_assembler=yes])
|
2007-12-08 23:42:33 +01:00
|
|
|
if test "x$enable_assembler" = xyes; then
|
2009-11-22 11:00:30 +01:00
|
|
|
enable_assembler=no
|
|
|
|
case $host_os in
|
|
|
|
# Darwin should work too but only if not creating universal
|
|
|
|
# binaries. Solaris x86 could work too but I cannot test.
|
2015-08-11 12:23:04 +02:00
|
|
|
linux* | *bsd* | mingw* | cygwin | msys | *djgpp*)
|
2009-11-22 11:00:30 +01:00
|
|
|
case $host_cpu in
|
|
|
|
i?86) enable_assembler=x86 ;;
|
|
|
|
esac
|
|
|
|
;;
|
2008-01-15 12:29:14 +01:00
|
|
|
esac
|
2007-12-08 23:42:33 +01:00
|
|
|
fi
|
|
|
|
case $enable_assembler in
|
2022-11-14 16:58:07 +01:00
|
|
|
x86 | no)
|
2009-11-22 11:00:30 +01:00
|
|
|
AC_MSG_RESULT([$enable_assembler])
|
2008-01-15 12:29:14 +01:00
|
|
|
;;
|
2007-12-08 23:42:33 +01:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
2023-09-24 16:09:16 +02:00
|
|
|
AC_MSG_ERROR([--enable-assembler accepts only 'yes', 'no', or 'x86' (32-bit).])
|
2007-12-08 23:42:33 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
|
2008-08-28 21:53:15 +02:00
|
|
|
|
|
|
|
|
2022-11-14 20:34:57 +01:00
|
|
|
#############
|
|
|
|
# CLMUL CRC #
|
|
|
|
#############
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([clmul-crc], AS_HELP_STRING([--disable-clmul-crc],
|
|
|
|
[Do not use carryless multiplication for CRC calculation
|
|
|
|
even if support for it is detected.]),
|
|
|
|
[], [enable_clmul_crc=yes])
|
|
|
|
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
#####################
|
|
|
|
# Size optimization #
|
|
|
|
#####################
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_CHECKING([if small size is preferred over speed])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([small], AS_HELP_STRING([--enable-small],
|
2008-08-28 21:53:15 +02:00
|
|
|
[Make liblzma smaller and a little slower.
|
|
|
|
This is disabled by default to optimize for speed.]),
|
2008-06-18 17:02:10 +02:00
|
|
|
[], [enable_small=no])
|
2007-12-08 23:42:33 +01:00
|
|
|
if test "x$enable_small" = xyes; then
|
2008-12-30 23:57:27 +01:00
|
|
|
AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
|
2007-12-08 23:42:33 +01:00
|
|
|
elif test "x$enable_small" != xno; then
|
|
|
|
AC_MSG_RESULT([])
|
2023-09-24 16:09:16 +02:00
|
|
|
AC_MSG_ERROR([--enable-small accepts only 'yes' or 'no'])
|
2007-12-08 23:42:33 +01:00
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$enable_small])
|
|
|
|
AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
|
|
|
|
|
2008-08-28 21:53:15 +02:00
|
|
|
|
2008-12-30 23:30:49 +01:00
|
|
|
#############
|
|
|
|
# Threading #
|
|
|
|
#############
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if threading support is wanted])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD],
|
2023-09-24 16:09:16 +02:00
|
|
|
[Supported METHODS are 'yes', 'no', 'posix', 'win95', and
|
|
|
|
'vista'. The default is 'yes'. Using 'no' together with
|
2013-09-17 10:52:28 +02:00
|
|
|
--enable-small makes liblzma thread unsafe.]),
|
2008-12-30 23:30:49 +01:00
|
|
|
[], [enable_threads=yes])
|
2013-09-17 10:52:28 +02:00
|
|
|
|
|
|
|
if test "x$enable_threads" = xyes; then
|
|
|
|
case $host_os in
|
|
|
|
mingw*)
|
|
|
|
case $host_cpu in
|
|
|
|
i?86) enable_threads=win95 ;;
|
|
|
|
*) enable_threads=vista ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
enable_threads=posix
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $enable_threads in
|
|
|
|
posix | win95 | vista)
|
|
|
|
AC_MSG_RESULT([yes, $enable_threads])
|
|
|
|
;;
|
|
|
|
no)
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
2023-09-24 16:09:16 +02:00
|
|
|
AC_MSG_ERROR([--enable-threads only accepts 'yes', 'no', 'posix', 'win95', or 'vista'])
|
2013-09-17 10:52:28 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2008-12-30 23:30:49 +01:00
|
|
|
# We use the actual result a little later.
|
|
|
|
|
|
|
|
|
2009-10-02 13:35:56 +02:00
|
|
|
#########################
|
|
|
|
# Assumed amount of RAM #
|
|
|
|
#########################
|
|
|
|
|
2010-03-07 12:34:34 +01:00
|
|
|
# We use 128 MiB as default, because it will allow decompressing files
|
|
|
|
# created with "xz -9". It would be slightly safer to guess a lower value,
|
|
|
|
# but most systems, on which we don't have any way to determine the amount
|
|
|
|
# of RAM, will probably have at least 128 MiB of RAM.
|
2009-10-02 13:35:56 +02:00
|
|
|
AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([assume-ram], AS_HELP_STRING([--enable-assume-ram=SIZE],
|
2009-10-02 13:35:56 +02:00
|
|
|
[If and only if the real amount of RAM cannot be determined,
|
2010-03-07 12:34:34 +01:00
|
|
|
assume SIZE MiB. The default is 128 MiB. This affects the
|
2009-10-02 13:35:56 +02:00
|
|
|
default memory usage limit.]),
|
2010-03-07 12:34:34 +01:00
|
|
|
[], [enable_assume_ram=128])
|
2009-10-02 13:35:56 +02:00
|
|
|
assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789`
|
|
|
|
if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument])
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$enable_assume_ram MiB])
|
|
|
|
AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
|
|
|
|
[How many MiB of RAM to assume if the real amount cannot
|
|
|
|
be determined.])
|
|
|
|
|
|
|
|
|
2010-10-08 14:25:45 +02:00
|
|
|
#########################
|
|
|
|
# Components to install #
|
|
|
|
#########################
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([xz], [AS_HELP_STRING([--disable-xz],
|
2010-10-08 14:25:45 +02:00
|
|
|
[do not build the xz tool])],
|
|
|
|
[], [enable_xz=yes])
|
|
|
|
AM_CONDITIONAL([COND_XZ], [test x$enable_xz != xno])
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([xzdec], [AS_HELP_STRING([--disable-xzdec],
|
2010-10-08 14:25:45 +02:00
|
|
|
[do not build xzdec])],
|
|
|
|
[], [enable_xzdec=yes])
|
2015-11-03 19:47:07 +01:00
|
|
|
test "x$enable_decoders" = xno && enable_xzdec=no
|
2010-10-08 14:25:45 +02:00
|
|
|
AM_CONDITIONAL([COND_XZDEC], [test x$enable_xzdec != xno])
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([lzmadec], [AS_HELP_STRING([--disable-lzmadec],
|
2010-10-08 14:25:45 +02:00
|
|
|
[do not build lzmadec
|
|
|
|
(it exists primarily for LZMA Utils compatibility)])],
|
|
|
|
[], [enable_lzmadec=yes])
|
2015-11-03 19:47:07 +01:00
|
|
|
test "x$enable_decoder_lzma1" = xno && enable_lzmadec=no
|
2010-10-08 14:25:45 +02:00
|
|
|
AM_CONDITIONAL([COND_LZMADEC], [test x$enable_lzmadec != xno])
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([lzmainfo], [AS_HELP_STRING([--disable-lzmainfo],
|
2010-10-08 14:25:45 +02:00
|
|
|
[do not build lzmainfo
|
|
|
|
(it exists primarily for LZMA Utils compatibility)])],
|
|
|
|
[], [enable_lzmainfo=yes])
|
2015-11-03 19:47:07 +01:00
|
|
|
test "x$enable_decoder_lzma1" = xno && enable_lzmainfo=no
|
2010-10-08 14:25:45 +02:00
|
|
|
AM_CONDITIONAL([COND_LZMAINFO], [test x$enable_lzmainfo != xno])
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([lzma-links], [AS_HELP_STRING([--disable-lzma-links],
|
2010-10-08 14:25:45 +02:00
|
|
|
[do not create symlinks for LZMA Utils compatibility])],
|
|
|
|
[], [enable_lzma_links=yes])
|
|
|
|
AM_CONDITIONAL([COND_LZMALINKS], [test x$enable_lzma_links != xno])
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([scripts], [AS_HELP_STRING([--disable-scripts],
|
2010-10-08 14:25:45 +02:00
|
|
|
[do not install the scripts xzdiff, xzgrep, xzless, xzmore,
|
|
|
|
and their symlinks])],
|
|
|
|
[], [enable_scripts=yes])
|
|
|
|
AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
|
|
|
|
|
2014-11-17 17:52:21 +01:00
|
|
|
AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc],
|
2014-04-25 16:44:26 +02:00
|
|
|
[do not install documentation files to docdir
|
|
|
|
(man pages will still be installed)])],
|
|
|
|
[], [enable_doc=yes])
|
|
|
|
AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
|
|
|
|
|
2010-10-08 14:25:45 +02:00
|
|
|
|
2015-03-31 21:19:34 +02:00
|
|
|
##############
|
|
|
|
# Sandboxing #
|
|
|
|
##############
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if sandboxing should be used])
|
|
|
|
AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD],
|
2022-10-25 20:11:58 +02:00
|
|
|
[Sandboxing METHOD can be
|
2023-09-24 16:09:16 +02:00
|
|
|
'auto', 'no', 'capsicum', or 'pledge'.
|
|
|
|
The default is 'auto' which enables sandboxing if
|
2015-03-31 21:19:34 +02:00
|
|
|
a supported sandboxing method is found.])],
|
|
|
|
[], [enable_sandbox=auto])
|
|
|
|
case $enable_sandbox in
|
|
|
|
auto)
|
|
|
|
AC_MSG_RESULT([maybe (autodetect)])
|
|
|
|
;;
|
2022-10-25 20:11:58 +02:00
|
|
|
no | capsicum | pledge)
|
2015-03-31 21:19:34 +02:00
|
|
|
AC_MSG_RESULT([$enable_sandbox])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
2023-09-24 16:09:16 +02:00
|
|
|
AC_MSG_ERROR([--enable-sandbox only accepts 'auto', 'no', 'capsicum', or 'pledge'.])
|
2015-03-31 21:19:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2019-09-24 22:02:40 +02:00
|
|
|
###########################
|
|
|
|
# PATH prefix for scripts #
|
|
|
|
###########################
|
|
|
|
|
|
|
|
# The scripts can add a prefix to the search PATH so that POSIX tools
|
|
|
|
# or the xz binary is always in the PATH.
|
|
|
|
AC_ARG_ENABLE([path-for-scripts],
|
|
|
|
[AS_HELP_STRING([--enable-path-for-scripts=PREFIX],
|
|
|
|
[If PREFIX isn't empty, PATH=PREFIX:$PATH will be set in
|
|
|
|
the beginning of the scripts (xzgrep and others).
|
|
|
|
The default is empty except on Solaris the default is
|
|
|
|
/usr/xpg4/bin.])],
|
|
|
|
[], [
|
|
|
|
case $host_os in
|
|
|
|
solaris*) enable_path_for_scripts=/usr/xpg4/bin ;;
|
|
|
|
*) enable_path_for_scripts= ;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
if test -n "$enable_path_for_scripts" && test "x$enable_path_for_scripts" != xno ; then
|
|
|
|
enable_path_for_scripts="PATH=$enable_path_for_scripts:\$PATH"
|
|
|
|
else
|
|
|
|
enable_path_for_scripts=
|
|
|
|
fi
|
|
|
|
AC_SUBST([enable_path_for_scripts])
|
|
|
|
|
|
|
|
|
2008-01-06 20:47:17 +01:00
|
|
|
###############################################################################
|
|
|
|
# Checks for programs.
|
|
|
|
###############################################################################
|
|
|
|
|
2009-07-05 21:25:17 +02:00
|
|
|
echo
|
2020-02-05 18:33:37 +01:00
|
|
|
case $host_os in
|
|
|
|
solaris*)
|
|
|
|
# The gnulib POSIX shell macro below may pick a shell that
|
|
|
|
# doesn't work with xzgrep. Workaround by picking a shell
|
|
|
|
# that is known to work.
|
|
|
|
if test -z "$gl_cv_posix_shell" && test -x /usr/xpg4/bin/sh; then
|
|
|
|
gl_cv_posix_shell=/usr/xpg4/bin/sh
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2009-07-05 21:25:17 +02:00
|
|
|
gl_POSIX_SHELL
|
2014-12-26 11:00:05 +01:00
|
|
|
if test -z "$POSIX_SHELL" && test "x$enable_scripts" = xyes ; then
|
2009-07-05 21:25:17 +02:00
|
|
|
AC_MSG_ERROR([No POSIX conforming shell (sh) was found.])
|
|
|
|
fi
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
echo
|
|
|
|
echo "Initializing Automake:"
|
|
|
|
|
2014-10-29 20:15:35 +01:00
|
|
|
# We don't use "subdir-objects" yet because it breaks "make distclean" when
|
|
|
|
# dependencies are enabled (as of Automake 1.14.1) due to this bug:
|
2023-03-18 14:51:57 +01:00
|
|
|
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17354
|
2014-10-29 20:15:35 +01:00
|
|
|
# The -Wno-unsupported is used to silence warnings about missing
|
|
|
|
# "subdir-objects".
|
2022-05-23 20:31:36 +02:00
|
|
|
AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 -Wno-unsupported])
|
2008-01-06 20:47:17 +01:00
|
|
|
AC_PROG_LN_S
|
2008-05-11 13:17:21 +02:00
|
|
|
|
2023-03-21 13:07:51 +01:00
|
|
|
dnl # Autoconf >= 2.70 warns that AC_PROG_CC_C99 is obsolete. However,
|
|
|
|
dnl # we have to keep using AC_PROG_CC_C99 instead of AC_PROG_CC
|
|
|
|
dnl # as long as we try to be compatible with Autoconf 2.69.
|
2008-05-11 13:17:21 +02:00
|
|
|
AC_PROG_CC_C99
|
|
|
|
if test x$ac_cv_prog_cc_c99 = xno ; then
|
|
|
|
AC_MSG_ERROR([No C99 compiler was found.])
|
|
|
|
fi
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AM_PROG_CC_C_O
|
|
|
|
AM_PROG_AS
|
2008-01-06 20:47:17 +01:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2023-03-21 12:11:49 +01:00
|
|
|
AS_CASE([$enable_threads],
|
|
|
|
[posix], [
|
2013-09-17 10:52:28 +02:00
|
|
|
echo
|
|
|
|
echo "POSIX threading support:"
|
|
|
|
AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
|
|
|
|
LIBS="$LIBS $PTHREAD_LIBS"
|
|
|
|
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
|
|
|
|
|
|
|
|
dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX,
|
|
|
|
dnl but it's tricky to get it right together with
|
|
|
|
dnl AC_PROG_CC_C99. Thus, this is handled by telling the
|
|
|
|
dnl user in INSTALL to set the correct CC manually.
|
|
|
|
|
|
|
|
AC_DEFINE([MYTHREAD_POSIX], [1],
|
|
|
|
[Define to 1 when using POSIX threads (pthreads).])
|
|
|
|
|
2023-09-23 02:23:32 +02:00
|
|
|
# This is nice to have but not mandatory.
|
2013-09-17 10:52:28 +02:00
|
|
|
OLD_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
2023-09-23 02:23:32 +02:00
|
|
|
AC_CHECK_FUNCS([pthread_condattr_setclock])
|
2013-09-17 10:52:28 +02:00
|
|
|
CFLAGS=$OLD_CFLAGS
|
2023-03-21 12:11:49 +01:00
|
|
|
],
|
|
|
|
[win95], [
|
2013-09-17 10:52:28 +02:00
|
|
|
AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using
|
|
|
|
Windows 95 (and thus XP) compatible threads.
|
|
|
|
This avoids use of features that were added in
|
|
|
|
Windows Vista.])
|
2023-03-21 12:11:49 +01:00
|
|
|
],
|
|
|
|
[vista], [
|
2013-09-17 10:52:28 +02:00
|
|
|
AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using
|
|
|
|
Windows Vista compatible threads. This uses
|
|
|
|
features that are not available on Windows XP.])
|
2023-03-21 12:11:49 +01:00
|
|
|
]
|
|
|
|
)
|
2013-09-17 10:52:28 +02:00
|
|
|
AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Initializing Libtool:"
|
2020-02-15 14:07:11 +01:00
|
|
|
LT_PREREQ([2.4])
|
2009-08-27 14:43:54 +02:00
|
|
|
LT_INIT([win32-dll])
|
|
|
|
LT_LANG([Windows Resource])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2009-06-30 16:09:57 +02:00
|
|
|
# This is a bit wrong since it is possible to request that only some libs
|
|
|
|
# are built as shared. Using that feature isn't so common though, and this
|
|
|
|
# breaks only on Windows (at least for now) if the user enables only some
|
|
|
|
# libs as shared.
|
|
|
|
AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
|
|
|
|
|
2022-11-24 13:52:44 +01:00
|
|
|
#####################
|
|
|
|
# Symbol versioning #
|
|
|
|
#####################
|
|
|
|
|
|
|
|
# NOTE: This checks if we are building shared or static library
|
|
|
|
# and if --with-pic or --without-pic was used. Thus this check
|
|
|
|
# must be after Libtool initialization.
|
|
|
|
AC_MSG_CHECKING([if library symbol versioning should be used])
|
|
|
|
AC_ARG_ENABLE([symbol-versions], [AS_HELP_STRING([--enable-symbol-versions],
|
|
|
|
[Use symbol versioning for liblzma. Enabled by default on
|
|
|
|
GNU/Linux, other GNU-based systems, and FreeBSD.])],
|
|
|
|
[], [enable_symbol_versions=auto])
|
|
|
|
if test "x$enable_symbol_versions" = xauto; then
|
|
|
|
case $host_os in
|
|
|
|
# NOTE: Even if one omits -gnu on GNU/Linux (e.g.
|
|
|
|
# i486-slackware-linux), configure will (via config.sub)
|
|
|
|
# append -gnu (e.g. i486-slackware-linux-gnu), and this
|
|
|
|
# test will work correctly.
|
|
|
|
gnu* | *-gnu* | freebsd*)
|
|
|
|
enable_symbol_versions=yes
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
enable_symbol_versions=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# There are two variants for symbol versioning.
|
|
|
|
# See src/liblzma/validate_map.sh for details.
|
|
|
|
#
|
|
|
|
# On GNU/Linux, extra symbols are added in the C code. These extra symbols
|
|
|
|
# must not be put into a static library as they can cause problems (and
|
|
|
|
# even if they didn't cause problems, they would be useless). On other
|
|
|
|
# systems symbol versioning may be used too but there is no problem as only
|
|
|
|
# a linker script is specified in src/liblzma/Makefile.am and that isn't
|
|
|
|
# used when creating a static library.
|
|
|
|
#
|
|
|
|
# Libtool always uses -DPIC when building shared libraries by default and
|
2023-07-31 14:02:21 +02:00
|
|
|
# doesn't use it for static libs by default. This can be overridden with
|
2022-11-24 13:52:44 +01:00
|
|
|
# --with-pic and --without-pic though. As long as neither --with-pic nor
|
|
|
|
# --without-pic is used then we can use #ifdef PIC to detect if the file is
|
|
|
|
# being built for a shared library.
|
|
|
|
if test "x$enable_symbol_versions" = xno ; then
|
|
|
|
enable_symbol_versions=no
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
elif test "x$enable_shared" = xno ; then
|
|
|
|
enable_symbol_versions=no
|
|
|
|
AC_MSG_RESULT([no (not building a shared library)])
|
|
|
|
else
|
2023-02-17 19:48:28 +01:00
|
|
|
case "$host_cpu-$host_os" in
|
|
|
|
microblaze*)
|
|
|
|
# GCC 12 on MicroBlaze doesn't support __symver__
|
|
|
|
# attribute. It's simplest and safest to use the
|
|
|
|
# generic version on that platform since then only
|
|
|
|
# the linker script is needed. The RHEL/CentOS 7
|
|
|
|
# compatibility symbols don't matter on MicroBlaze.
|
|
|
|
enable_symbol_versions=generic
|
|
|
|
;;
|
|
|
|
*-linux*)
|
2022-11-24 13:52:44 +01:00
|
|
|
case "$pic_mode-$enable_static" in
|
|
|
|
default-*)
|
|
|
|
# Use symvers if PIC is defined.
|
|
|
|
have_symbol_versions_linux=2
|
|
|
|
;;
|
|
|
|
*-no)
|
|
|
|
# Not building static library.
|
|
|
|
# Use symvers unconditionally.
|
|
|
|
have_symbol_versions_linux=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([])
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
On GNU/Linux, building both shared and static library at the same time
|
|
|
|
is not supported if --with-pic or --without-pic is used.
|
|
|
|
Use either --disable-shared or --disable-static to build one type
|
|
|
|
of library at a time. If both types are needed, build one at a time,
|
|
|
|
possibly picking only src/liblzma/.libs/liblzma.a from the static build.])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
enable_symbol_versions=linux
|
|
|
|
AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX],
|
|
|
|
[$have_symbol_versions_linux],
|
|
|
|
[Define to 1 to if GNU/Linux-specific details
|
|
|
|
are unconditionally wanted for symbol
|
|
|
|
versioning. Define to 2 to if these are wanted
|
|
|
|
only if also PIC is defined (allows building
|
|
|
|
both shared and static liblzma at the same
|
|
|
|
time with Libtool if neither --with-pic nor
|
|
|
|
--without-pic is used). This define must be
|
|
|
|
used together with liblzma_linux.map.])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
enable_symbol_versions=generic
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_MSG_RESULT([yes ($enable_symbol_versions)])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AM_CONDITIONAL([COND_SYMVERS_LINUX],
|
|
|
|
[test "x$enable_symbol_versions" = xlinux])
|
|
|
|
AM_CONDITIONAL([COND_SYMVERS_GENERIC],
|
|
|
|
[test "x$enable_symbol_versions" = xgeneric])
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Checks for libraries.
|
|
|
|
###############################################################################
|
|
|
|
|
2020-02-15 02:08:32 +01:00
|
|
|
dnl Support for _REQUIRE_VERSION was added in gettext 0.19.6. If both
|
|
|
|
dnl _REQUIRE_VERSION and _VERSION are present, the _VERSION is ignored.
|
|
|
|
dnl We use both for compatibility with other programs in the Autotools family.
|
2007-12-08 23:42:33 +01:00
|
|
|
echo
|
|
|
|
echo "Initializing gettext:"
|
2020-02-15 02:08:32 +01:00
|
|
|
AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
|
|
|
|
AM_GNU_GETTEXT_VERSION([0.19.6])
|
2007-12-08 23:42:33 +01:00
|
|
|
AM_GNU_GETTEXT([external])
|
|
|
|
|
2014-07-25 19:57:20 +02:00
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
###############################################################################
|
|
|
|
# Checks for header files.
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "System headers and functions:"
|
|
|
|
|
|
|
|
# There is currently no workarounds in this package if some of
|
|
|
|
# these headers are missing.
|
|
|
|
AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h],
|
|
|
|
[],
|
|
|
|
[AC_MSG_ERROR([Required header file(s) are missing.])])
|
|
|
|
|
2022-11-14 20:34:57 +01:00
|
|
|
# immintrin.h allows the use of the intrinsic functions if they are available.
|
|
|
|
# cpuid.h may be used for detecting x86 processor features at runtime.
|
|
|
|
AC_CHECK_HEADERS([immintrin.h cpuid.h])
|
2014-07-25 19:57:20 +02:00
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
###############################################################################
|
|
|
|
|
2008-01-06 15:27:41 +01:00
|
|
|
AC_HEADER_STDBOOL
|
|
|
|
|
|
|
|
AC_TYPE_UINT8_T
|
2008-11-19 22:55:22 +01:00
|
|
|
AC_TYPE_UINT16_T
|
2008-01-06 15:27:41 +01:00
|
|
|
AC_TYPE_INT32_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_INT64_T
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
AC_TYPE_UINTPTR_T
|
|
|
|
|
|
|
|
AC_CHECK_SIZEOF([size_t])
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
# The command line tool can copy high resolution timestamps if such
|
2012-08-24 15:27:31 +02:00
|
|
|
# information is available in struct stat. Otherwise one second accuracy
|
2008-11-19 19:46:52 +01:00
|
|
|
# is used.
|
|
|
|
AC_CHECK_MEMBERS([
|
|
|
|
struct stat.st_atim.tv_nsec,
|
|
|
|
struct stat.st_atimespec.tv_nsec,
|
|
|
|
struct stat.st_atimensec,
|
|
|
|
struct stat.st_uatime,
|
|
|
|
struct stat.st_atim.st__tim.tv_nsec])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
|
2022-11-14 15:00:52 +01:00
|
|
|
# __attribute__((__constructor__)) can be used for one-time initializations.
|
|
|
|
# Use -Werror because some compilers accept unknown attributes and just
|
2023-09-26 16:24:15 +02:00
|
|
|
# give a warning.
|
|
|
|
#
|
|
|
|
# FIXME? Unfortunately -Werror can cause trouble if CFLAGS contains options
|
|
|
|
# that produce warnings for unrelated reasons. For example, GCC and Clang
|
|
|
|
# support -Wunused-macros which will warn about "#define _GNU_SOURCE 1"
|
|
|
|
# which will be among the #defines that Autoconf inserts to the beginning of
|
|
|
|
# the test program. There seems to be no nice way to prevent Autoconf from
|
|
|
|
# inserting the any defines to the test program.
|
2022-11-14 15:00:52 +01:00
|
|
|
AC_MSG_CHECKING([if __attribute__((__constructor__)) can be used])
|
|
|
|
have_func_attribute_constructor=no
|
|
|
|
OLD_CFLAGS="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -Werror"
|
2023-09-26 12:14:37 +02:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
2022-11-14 15:00:52 +01:00
|
|
|
__attribute__((__constructor__))
|
|
|
|
static void my_constructor_func(void) { return; }
|
2023-09-26 12:14:37 +02:00
|
|
|
]])], [
|
2022-11-14 15:00:52 +01:00
|
|
|
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR], [1],
|
|
|
|
[Define to 1 if __attribute__((__constructor__))
|
|
|
|
is supported for functions.])
|
|
|
|
have_func_attribute_constructor=yes
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
CFLAGS="$OLD_CFLAGS"
|
|
|
|
|
2023-08-09 14:35:16 +02:00
|
|
|
# The Win95 threading lacks a thread-safe one-time initialization function.
|
|
|
|
# The one-time initialization is needed for crc32_small.c and crc64_small.c
|
|
|
|
# create the CRC tables. So if small mode is enabled, the threading mode is
|
|
|
|
# win95, and the compiler does not support attribute constructor, then we
|
|
|
|
# would end up with a multithreaded build that is thread-unsafe. As a
|
|
|
|
# result this configuration is not allowed.
|
|
|
|
if test "x$enable_small$enable_threads$have_func_attribute_constructor"\
|
|
|
|
= xyeswin95no; then
|
|
|
|
AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be
|
|
|
|
used at the same time with a compiler that doesn't support
|
|
|
|
__attribute__((__constructor__))])
|
|
|
|
fi
|
|
|
|
|
2023-06-27 16:24:49 +02:00
|
|
|
# __attribute__((__ifunc__())) can be used to choose between different
|
|
|
|
# implementations of the same function at runtime. This is slightly more
|
|
|
|
# efficient than using __attribute__((__constructor__)) and setting
|
|
|
|
# a function pointer.
|
2023-06-22 19:46:55 +02:00
|
|
|
AC_ARG_ENABLE([ifunc], [AS_HELP_STRING([--disable-ifunc],
|
|
|
|
[do not use __attribute__((__ifunc__()))])],
|
|
|
|
[], [enable_ifunc=yes])
|
|
|
|
|
|
|
|
if test "x$enable_ifunc" = xyes ; then
|
|
|
|
OLD_CFLAGS="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -Werror"
|
|
|
|
AC_MSG_CHECKING([if __attribute__((__ifunc__())) can be used])
|
2023-09-26 12:14:37 +02:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
2023-06-22 19:46:55 +02:00
|
|
|
static void func(void) { return; }
|
|
|
|
static void (*resolve_func (void)) (void) { return func; }
|
|
|
|
void func_ifunc (void)
|
2023-06-27 16:24:49 +02:00
|
|
|
__attribute__((__ifunc__("resolve_func")));
|
2023-09-26 14:00:43 +02:00
|
|
|
/*
|
|
|
|
* 'clang -Wall' incorrectly warns that resolve_func is
|
|
|
|
* unused (-Wunused-function). Correct assembly output is
|
|
|
|
* still produced. This problem exists at least in Clang
|
|
|
|
* versions 4 to 17. The following silences the bogus warning:
|
|
|
|
*/
|
|
|
|
void make_clang_quiet(void);
|
|
|
|
void make_clang_quiet(void) { resolve_func()(); }
|
2023-09-26 12:14:37 +02:00
|
|
|
]])], [
|
2023-06-22 19:46:55 +02:00
|
|
|
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_IFUNC], [1],
|
|
|
|
[Define to 1 if __attribute__((__ifunc__()))
|
|
|
|
is supported for functions.])
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
CFLAGS="$OLD_CFLAGS"
|
|
|
|
fi
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Checks for library functions.
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# Gnulib replacements as needed
|
|
|
|
gl_GETOPT
|
|
|
|
|
2023-09-23 02:23:32 +02:00
|
|
|
# If clock_gettime() is available, liblzma with pthreads may use it, and
|
|
|
|
# xz may use it even when threading support is disabled. In XZ Utils 5.4.x
|
|
|
|
# and older, configure checked for clock_gettime() only when using pthreads.
|
|
|
|
# This way non-threaded builds of liblzma didn't get a useless dependency on
|
|
|
|
# librt which further had a dependency on libpthread. Avoiding these was
|
|
|
|
# useful when a small build was needed, for example, for initramfs use.
|
|
|
|
#
|
|
|
|
# The above reasoning is thoroughly obsolete: On GNU/Linux, librt hasn't
|
|
|
|
# been needed for clock_gettime() since glibc 2.17 (2012-12-25).
|
|
|
|
# Solaris 10 needs librt but Solaris 11 doesn't anymore.
|
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
|
|
|
AC_CHECK_FUNCS([clock_gettime])
|
|
|
|
AC_CHECK_DECL([CLOCK_MONOTONIC], [AC_DEFINE([HAVE_CLOCK_MONOTONIC], [1],
|
|
|
|
[Define to 1 if 'CLOCK_MONOTONIC' is declared in <time.h>.])], [],
|
|
|
|
[[#include <time.h>]])
|
|
|
|
|
2008-11-19 19:46:52 +01:00
|
|
|
# Find the best function to set timestamps.
|
2016-06-30 19:27:36 +02:00
|
|
|
AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2015-04-20 18:59:18 +02:00
|
|
|
# This is nice to have but not mandatory.
|
|
|
|
AC_CHECK_FUNCS([posix_fadvise])
|
2011-04-05 14:27:26 +02:00
|
|
|
|
2009-09-19 08:47:30 +02:00
|
|
|
TUKLIB_PROGNAME
|
2009-10-04 21:57:12 +02:00
|
|
|
TUKLIB_INTEGER
|
2009-09-19 08:47:30 +02:00
|
|
|
TUKLIB_PHYSMEM
|
|
|
|
TUKLIB_CPUCORES
|
2010-09-10 09:30:33 +02:00
|
|
|
TUKLIB_MBSTR
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2019-06-24 23:16:06 +02:00
|
|
|
# If requested, check for system-provided SHA-256. At least the following
|
2016-03-13 19:21:49 +01:00
|
|
|
# implementations are supported:
|
2011-05-21 14:08:44 +02:00
|
|
|
#
|
|
|
|
# OS Headers Library Type Function
|
2016-03-13 19:21:49 +01:00
|
|
|
# FreeBSD sys/types.h + sha256.h libmd SHA256_CTX SHA256_Init
|
2011-05-21 14:08:44 +02:00
|
|
|
# NetBSD sys/types.h + sha2.h SHA256_CTX SHA256_Init
|
|
|
|
# OpenBSD sys/types.h + sha2.h SHA2_CTX SHA256Init
|
|
|
|
# Solaris sys/types.h + sha2.h libmd SHA256_CTX SHA256Init
|
2016-03-13 19:21:49 +01:00
|
|
|
# MINIX 3 sys/types.h + sha2.h SHA256_CTX SHA256_Init
|
2011-05-21 14:08:44 +02:00
|
|
|
# Darwin CommonCrypto/CommonDigest.h CC_SHA256_CTX CC_SHA256_Init
|
|
|
|
#
|
2016-03-13 19:21:49 +01:00
|
|
|
# Note that Darwin's CC_SHA256_Update takes buffer size as uint32_t instead
|
|
|
|
# of size_t.
|
2016-03-10 19:26:49 +01:00
|
|
|
#
|
2016-03-13 19:21:49 +01:00
|
|
|
sha256_header_found=no
|
|
|
|
sha256_type_found=no
|
|
|
|
sha256_func_found=no
|
2023-03-21 13:04:37 +01:00
|
|
|
AS_IF([test "x$enable_external_sha256" = "xyes"], [
|
2011-05-21 14:08:44 +02:00
|
|
|
# Test for Common Crypto before others, because Darwin has sha256.h
|
|
|
|
# too and we don't want to use that, because on older versions it
|
|
|
|
# uses OpenSSL functions, whose SHA256_Init is not guaranteed to
|
|
|
|
# succeed.
|
|
|
|
AC_CHECK_HEADERS(
|
2016-03-13 19:21:49 +01:00
|
|
|
[CommonCrypto/CommonDigest.h sha256.h sha2.h],
|
2011-05-21 14:08:44 +02:00
|
|
|
[sha256_header_found=yes ; break])
|
|
|
|
if test "x$sha256_header_found" = xyes; then
|
2016-03-13 19:21:49 +01:00
|
|
|
AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX],
|
|
|
|
[sha256_type_found=yes], [],
|
2011-05-23 23:23:46 +02:00
|
|
|
[[#ifdef HAVE_SYS_TYPES_H
|
2011-05-21 14:08:44 +02:00
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
|
|
|
|
# include <CommonCrypto/CommonDigest.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SHA256_H
|
|
|
|
# include <sha256.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SHA2_H
|
|
|
|
# include <sha2.h>
|
|
|
|
#endif]])
|
2016-03-13 19:21:49 +01:00
|
|
|
if test "x$sha256_type_found" = xyes ; then
|
|
|
|
AC_SEARCH_LIBS([SHA256Init], [md])
|
|
|
|
AC_SEARCH_LIBS([SHA256_Init], [md])
|
|
|
|
AC_CHECK_FUNCS([CC_SHA256_Init SHA256Init SHA256_Init],
|
|
|
|
[sha256_func_found=yes ; break])
|
|
|
|
fi
|
2011-05-21 14:08:44 +02:00
|
|
|
fi
|
2023-03-21 13:04:37 +01:00
|
|
|
])
|
2016-03-13 19:21:49 +01:00
|
|
|
AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno])
|
|
|
|
if test "x$enable_external_sha256$sha256_func_found" = xyesno; then
|
|
|
|
AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found])
|
|
|
|
fi
|
2011-05-21 14:08:44 +02:00
|
|
|
|
2022-10-31 15:26:05 +01:00
|
|
|
# Check for SSE2 intrinsics. There is no run-time detection for SSE2 so if
|
|
|
|
# compiler options enable SSE2 then SSE2 support is required by the binaries.
|
|
|
|
# The compile-time check for SSE2 is done with #ifdefs because some compilers
|
|
|
|
# (ICC, MSVC) allow SSE2 intrinsics even when SSE2 isn't enabled.
|
2014-07-25 19:57:20 +02:00
|
|
|
AC_CHECK_DECL([_mm_movemask_epi8],
|
|
|
|
[AC_DEFINE([HAVE__MM_MOVEMASK_EPI8], [1],
|
|
|
|
[Define to 1 if _mm_movemask_epi8 is available.])],
|
|
|
|
[],
|
|
|
|
[#ifdef HAVE_IMMINTRIN_H
|
|
|
|
#include <immintrin.h>
|
|
|
|
#endif])
|
|
|
|
|
2022-11-14 20:34:57 +01:00
|
|
|
# For faster CRC on 32/64-bit x86 and E2K (see also crc64_fast.c):
|
|
|
|
#
|
|
|
|
# - Check for the CLMUL intrinsic _mm_clmulepi64_si128 in <immintrin.h>.
|
2023-01-07 18:31:15 +01:00
|
|
|
# Check also for _mm_set_epi64x for consistency with CMake build
|
|
|
|
# where it's needed to disable CLMUL with VS2013.
|
2022-11-14 20:34:57 +01:00
|
|
|
#
|
|
|
|
# - Check that __attribute__((__target__("ssse3,sse4.1,pclmul"))) works
|
|
|
|
# together with _mm_clmulepi64_si128 from <immintrin.h>. The attribute
|
|
|
|
# was added in GCC 4.4 but some GCC 4.x versions don't allow intrinsics
|
|
|
|
# with it. Exception: it must be not be used with EDG-based compilers
|
|
|
|
# like ICC and the compiler on E2K.
|
|
|
|
#
|
|
|
|
# If everything above is supported, runtime detection will be used to keep the
|
|
|
|
# binaries working on systems that don't support the required extensions.
|
|
|
|
AC_MSG_CHECKING([if _mm_clmulepi64_si128 is usable])
|
2023-03-21 13:04:37 +01:00
|
|
|
AS_IF([test "x$enable_clmul_crc" = xno], [
|
2022-11-14 20:34:57 +01:00
|
|
|
AC_MSG_RESULT([no, --disable-clmul-crc was used])
|
2023-03-21 13:04:37 +01:00
|
|
|
], [
|
2022-11-14 20:34:57 +01:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
|
|
#include <immintrin.h>
|
|
|
|
|
|
|
|
// CLMUL works on older E2K instruction set but it is slow due to emulation.
|
|
|
|
#if defined(__e2k__) && __iset__ < 6
|
|
|
|
# error
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Intel's old compiler (ICC) can define __GNUC__ but the attribute must not
|
|
|
|
// be used with it. The new Clang-based ICX needs the attribute.
|
|
|
|
// Checking for !defined(__EDG__) catches ICC and other EDG-based compilers.
|
|
|
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
|
|
|
__attribute__((__target__("ssse3,sse4.1,pclmul")))
|
|
|
|
#endif
|
2023-01-07 18:31:15 +01:00
|
|
|
__m128i my_clmul(__m128i a)
|
2022-11-14 20:34:57 +01:00
|
|
|
{
|
2023-01-07 18:31:15 +01:00
|
|
|
const __m128i b = _mm_set_epi64x(1, 2);
|
2022-11-14 20:34:57 +01:00
|
|
|
return _mm_clmulepi64_si128(a, b, 0);
|
|
|
|
}
|
|
|
|
]])], [
|
|
|
|
AC_DEFINE([HAVE_USABLE_CLMUL], [1],
|
2023-01-07 18:31:15 +01:00
|
|
|
[Define to 1 if _mm_set_epi64x and
|
|
|
|
_mm_clmulepi64_si128 are usable.
|
2022-11-14 20:34:57 +01:00
|
|
|
See configure.ac for details.])
|
2023-10-14 06:17:57 +02:00
|
|
|
enable_clmul_crc=yes
|
2022-11-14 20:34:57 +01:00
|
|
|
], [
|
2023-10-14 06:17:57 +02:00
|
|
|
enable_clmul_crc=no
|
2022-11-14 20:34:57 +01:00
|
|
|
])
|
2023-10-14 06:17:57 +02:00
|
|
|
AC_MSG_RESULT([$enable_clmul_crc])
|
2023-03-21 13:04:37 +01:00
|
|
|
])
|
2023-10-14 06:17:57 +02:00
|
|
|
AM_CONDITIONAL([COND_CRC_CLMUL], [test "x$enable_clmul_crc" = xyes])
|
2022-11-14 20:34:57 +01:00
|
|
|
|
2015-03-31 21:19:34 +02:00
|
|
|
# Check for sandbox support. If one is found, set enable_sandbox=found.
|
2023-03-21 13:04:37 +01:00
|
|
|
AS_CASE([$enable_sandbox],
|
|
|
|
[auto | capsicum], [
|
2023-10-09 17:13:08 +02:00
|
|
|
AC_CHECK_FUNCS([cap_rights_limit], [enable_sandbox=found])
|
2023-03-21 13:04:37 +01:00
|
|
|
]
|
|
|
|
)
|
|
|
|
AS_CASE([$enable_sandbox],
|
|
|
|
[auto | pledge], [
|
2023-10-09 17:13:08 +02:00
|
|
|
AC_CHECK_FUNCS([pledge], [enable_sandbox=found])
|
2023-03-21 13:04:37 +01:00
|
|
|
]
|
|
|
|
)
|
2015-03-31 21:19:34 +02:00
|
|
|
|
|
|
|
# If a specific sandboxing method was explicitly requested and it wasn't
|
|
|
|
# found, give an error.
|
|
|
|
case $enable_sandbox in
|
|
|
|
auto | no | found)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_ERROR([$enable_sandbox support not found])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
###############################################################################
|
2009-02-09 13:54:31 +01:00
|
|
|
# If using GCC, set some additional AM_CFLAGS:
|
2007-12-08 23:42:33 +01:00
|
|
|
###############################################################################
|
|
|
|
|
2009-07-01 11:21:24 +02:00
|
|
|
if test "$GCC" = yes ; then
|
2007-12-08 23:42:33 +01:00
|
|
|
echo
|
|
|
|
echo "GCC extensions:"
|
2009-07-01 11:21:24 +02:00
|
|
|
fi
|
2009-06-30 16:09:57 +02:00
|
|
|
|
2009-07-01 11:21:24 +02:00
|
|
|
# Always do the visibility check but don't set AM_CFLAGS on Windows.
|
|
|
|
# This way things get set properly even on Windows.
|
|
|
|
gl_VISIBILITY
|
|
|
|
if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
|
|
|
|
AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
|
|
|
|
fi
|
2007-12-08 23:42:33 +01:00
|
|
|
|
2023-03-21 13:04:37 +01:00
|
|
|
AS_IF([test "$GCC" = yes], [
|
2007-12-08 23:42:33 +01:00
|
|
|
# Enable as much warnings as possible. These commented warnings won't
|
2008-12-12 23:54:11 +01:00
|
|
|
# work for this package though:
|
2007-12-08 23:42:33 +01:00
|
|
|
# * -Wunreachable-code breaks several assert(0) cases, which are
|
|
|
|
# backed up with "return LZMA_PROG_ERROR".
|
|
|
|
# * -Wcast-qual would break various things where we need a non-const
|
|
|
|
# pointer although we don't modify anything through it.
|
2007-12-10 14:02:50 +01:00
|
|
|
# * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
|
|
|
|
# don't seem so useful here; at least the last one gives some
|
|
|
|
# warnings which are not bugs.
|
2023-01-12 03:17:24 +01:00
|
|
|
# * -Wconversion still shows too many warnings.
|
|
|
|
#
|
|
|
|
# The flags before the empty line are for GCC and many of them
|
|
|
|
# are supported by Clang too. The flags after the empty line are
|
|
|
|
# for Clang.
|
2008-01-05 18:42:04 +01:00
|
|
|
for NEW_FLAG in \
|
2009-02-09 13:54:31 +01:00
|
|
|
-Wall \
|
2008-01-05 18:42:04 +01:00
|
|
|
-Wextra \
|
2013-04-27 21:07:46 +02:00
|
|
|
-Wvla \
|
2009-02-09 13:54:31 +01:00
|
|
|
-Wformat=2 \
|
|
|
|
-Winit-self \
|
|
|
|
-Wmissing-include-dirs \
|
2023-01-12 03:17:24 +01:00
|
|
|
-Wshift-overflow=2 \
|
|
|
|
-Wstrict-overflow=3 \
|
|
|
|
-Walloc-zero \
|
|
|
|
-Wduplicated-cond \
|
2009-02-09 13:54:31 +01:00
|
|
|
-Wfloat-equal \
|
|
|
|
-Wundef \
|
|
|
|
-Wshadow \
|
|
|
|
-Wpointer-arith \
|
|
|
|
-Wbad-function-cast \
|
|
|
|
-Wwrite-strings \
|
2023-01-12 03:17:24 +01:00
|
|
|
-Wdate-time \
|
|
|
|
-Wsign-conversion \
|
|
|
|
-Wfloat-conversion \
|
2009-02-09 13:54:31 +01:00
|
|
|
-Wlogical-op \
|
|
|
|
-Waggregate-return \
|
|
|
|
-Wstrict-prototypes \
|
|
|
|
-Wold-style-definition \
|
|
|
|
-Wmissing-prototypes \
|
|
|
|
-Wmissing-declarations \
|
2023-01-12 03:17:24 +01:00
|
|
|
-Wredundant-decls \
|
|
|
|
\
|
|
|
|
-Wc99-compat \
|
|
|
|
-Wc11-extensions \
|
|
|
|
-Wc2x-compat \
|
|
|
|
-Wc2x-extensions \
|
|
|
|
-Wpre-c2x-compat \
|
|
|
|
-Warray-bounds-pointer-arithmetic \
|
|
|
|
-Wassign-enum \
|
|
|
|
-Wconditional-uninitialized \
|
|
|
|
-Wdocumentation \
|
|
|
|
-Wduplicate-enum \
|
|
|
|
-Wempty-translation-unit \
|
|
|
|
-Wflexible-array-extensions \
|
|
|
|
-Wmissing-variable-declarations \
|
|
|
|
-Wnewline-eof \
|
|
|
|
-Wshift-sign-overflow \
|
|
|
|
-Wstring-conversion
|
2007-12-08 23:42:33 +01:00
|
|
|
do
|
|
|
|
AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
|
|
|
|
OLD_CFLAGS="$CFLAGS"
|
2014-09-25 17:38:48 +02:00
|
|
|
CFLAGS="$CFLAGS $NEW_FLAG -Werror"
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
2023-09-26 12:51:31 +02:00
|
|
|
[[void foo(void); void foo(void) { }]])], [
|
2009-02-09 13:54:31 +01:00
|
|
|
AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
2009-02-09 13:54:31 +01:00
|
|
|
CFLAGS="$OLD_CFLAGS"
|
2007-12-08 23:42:33 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([werror],
|
2014-11-17 17:52:21 +01:00
|
|
|
AS_HELP_STRING([--enable-werror], [Enable -Werror to abort
|
2007-12-08 23:42:33 +01:00
|
|
|
compilation on all compiler warnings.]),
|
|
|
|
[], [enable_werror=no])
|
|
|
|
if test "x$enable_werror" = "xyes"; then
|
2009-02-09 13:54:31 +01:00
|
|
|
AM_CFLAGS="$AM_CFLAGS -Werror"
|
2007-12-08 23:42:33 +01:00
|
|
|
fi
|
2023-03-21 13:04:37 +01:00
|
|
|
])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Create the makefiles and config.h
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
# Don't build the lib directory at all if we don't need any replacement
|
|
|
|
# functions.
|
|
|
|
AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS")
|
|
|
|
|
2009-02-09 13:54:31 +01:00
|
|
|
# Add default AM_CFLAGS.
|
|
|
|
AC_SUBST([AM_CFLAGS])
|
|
|
|
|
2009-07-05 21:25:17 +02:00
|
|
|
# This is needed for src/scripts.
|
|
|
|
xz=`echo xz | sed "$program_transform_name"`
|
|
|
|
AC_SUBST([xz])
|
|
|
|
|
2007-12-08 23:42:33 +01:00
|
|
|
AC_CONFIG_FILES([
|
|
|
|
Makefile
|
|
|
|
po/Makefile.in
|
|
|
|
lib/Makefile
|
|
|
|
src/Makefile
|
|
|
|
src/liblzma/Makefile
|
|
|
|
src/liblzma/api/Makefile
|
2008-11-19 22:52:24 +01:00
|
|
|
src/xz/Makefile
|
|
|
|
src/xzdec/Makefile
|
2009-08-13 11:55:45 +02:00
|
|
|
src/lzmainfo/Makefile
|
2007-12-08 23:42:33 +01:00
|
|
|
src/scripts/Makefile
|
|
|
|
tests/Makefile
|
2008-01-18 19:18:08 +01:00
|
|
|
debug/Makefile
|
2007-12-08 23:42:33 +01:00
|
|
|
])
|
2011-08-06 19:37:28 +02:00
|
|
|
AC_CONFIG_FILES([src/scripts/xzdiff], [chmod +x src/scripts/xzdiff])
|
|
|
|
AC_CONFIG_FILES([src/scripts/xzgrep], [chmod +x src/scripts/xzgrep])
|
|
|
|
AC_CONFIG_FILES([src/scripts/xzmore], [chmod +x src/scripts/xzmore])
|
|
|
|
AC_CONFIG_FILES([src/scripts/xzless], [chmod +x src/scripts/xzless])
|
2007-12-08 23:42:33 +01:00
|
|
|
|
|
|
|
AC_OUTPUT
|
2009-11-20 11:51:19 +01:00
|
|
|
|
|
|
|
# Some warnings
|
|
|
|
if test x$tuklib_cv_physmem_method = xunknown; then
|
|
|
|
echo
|
|
|
|
echo "WARNING:"
|
|
|
|
echo "No supported method to detect the amount of RAM."
|
|
|
|
echo "Consider using --enable-assume-ram (if you didn't already)"
|
|
|
|
echo "or make a patch to add support for this operating system."
|
|
|
|
fi
|
|
|
|
|
2011-04-19 09:44:48 +02:00
|
|
|
if test x$tuklib_cv_cpucores_method = xunknown; then
|
|
|
|
echo
|
|
|
|
echo "WARNING:"
|
|
|
|
echo "No supported method to detect the number of CPU cores."
|
|
|
|
fi
|
2013-09-17 10:52:28 +02:00
|
|
|
|
2022-11-14 15:00:52 +01:00
|
|
|
if test "x$enable_threads$enable_small$have_func_attribute_constructor" \
|
|
|
|
= xnoyesno; then
|
2013-09-17 10:52:28 +02:00
|
|
|
echo
|
|
|
|
echo "NOTE:"
|
2022-11-14 15:00:52 +01:00
|
|
|
echo "liblzma will be thread-unsafe due to the combination"
|
|
|
|
echo "of --disable-threads --enable-small when using a compiler"
|
|
|
|
echo "that doesn't support __attribute__((__constructor__))."
|
2013-09-17 10:52:28 +02:00
|
|
|
fi
|