2015-10-22 23:54:34 +02:00
|
|
|
# -*- Autoconf -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
|
|
|
AC_PREREQ(2.69)
|
|
|
|
AC_INIT([libisal],
|
2019-03-25 20:57:17 +01:00
|
|
|
[2.26.0],
|
2015-10-22 23:54:34 +02:00
|
|
|
[sg.support.isal@intel.com],
|
|
|
|
[isa-l],
|
|
|
|
[http://01.org/storage-acceleration-library])
|
|
|
|
AC_CONFIG_SRCDIR([])
|
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
|
|
AM_INIT_AUTOMAKE([
|
|
|
|
foreign
|
|
|
|
1.11
|
|
|
|
-Wall
|
|
|
|
-Wno-portability
|
|
|
|
silent-rules
|
|
|
|
tar-pax
|
|
|
|
no-dist-gzip
|
|
|
|
dist-xz
|
|
|
|
subdir-objects
|
|
|
|
])
|
|
|
|
AM_PROG_AS
|
|
|
|
|
2017-03-02 23:23:22 +01:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
CPU=""
|
|
|
|
AS_CASE([$host_cpu],
|
|
|
|
[x86_64], [CPU="x86_64"],
|
|
|
|
[amd64], [CPU="x86_64"],
|
|
|
|
[i?86], [CPU="x86_32"],
|
2018-12-19 04:23:25 +01:00
|
|
|
[aarch64], [CPU="aarch64"],
|
|
|
|
[arm64], [CPU="aarch64"],
|
2017-03-02 23:23:22 +01:00
|
|
|
)
|
|
|
|
AM_CONDITIONAL([CPU_X86_64], [test "$CPU" = "x86_64"])
|
|
|
|
AM_CONDITIONAL([CPU_X86_32], [test "$CPU" = "x86_32"])
|
2018-12-19 04:23:25 +01:00
|
|
|
AM_CONDITIONAL([CPU_AARCH64], [test "$CPU" = "aarch64"])
|
2017-03-02 23:23:22 +01:00
|
|
|
AM_CONDITIONAL([CPU_UNDEFINED], [test "x$CPU" = "x"])
|
|
|
|
|
2018-12-07 10:01:35 +01:00
|
|
|
if test "$CPU" = "x86_64"; then
|
|
|
|
is_x86=yes
|
|
|
|
else
|
|
|
|
if test "$CPU" = "x86_32"; then
|
|
|
|
is_x86=yes
|
|
|
|
else
|
|
|
|
is_x86=no
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-10-22 23:54:34 +02:00
|
|
|
# Check for programs
|
|
|
|
AC_PROG_CC_STDC
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
AM_SILENT_RULES([yes])
|
|
|
|
LT_INIT
|
|
|
|
AC_PREFIX_DEFAULT([/usr])
|
|
|
|
AC_PROG_SED
|
|
|
|
AC_PROG_MKDIR_P
|
|
|
|
|
|
|
|
# Options
|
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
|
|
|
|
[], [enable_debug=no])
|
|
|
|
AS_IF([test "x$enable_debug" = "xyes"], [
|
|
|
|
AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
|
|
|
|
])
|
|
|
|
|
2018-12-07 10:01:35 +01:00
|
|
|
# If this build is for x86, look for yasm and nasm
|
|
|
|
if test x"$is_x86" = x"yes"; then
|
|
|
|
# Check for yasm and yasm features
|
|
|
|
AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
|
|
|
|
if test "$HAVE_YASM" = "no"; then
|
|
|
|
AC_MSG_RESULT([no yasm])
|
|
|
|
else
|
|
|
|
AC_MSG_CHECKING([for modern yasm])
|
|
|
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
|
|
|
|
if yasm -f elf64 -p gas conftest.c ; then
|
|
|
|
with_modern_yasm=yes
|
2015-11-18 23:40:52 +01:00
|
|
|
AC_MSG_RESULT([yes])
|
2018-12-07 10:01:35 +01:00
|
|
|
AC_MSG_CHECKING([for optional yasm AVX512 support])
|
|
|
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
|
|
|
|
if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
|
|
|
|
yasm_knows_avx512=yes
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
2015-11-18 23:40:52 +01:00
|
|
|
else
|
2018-12-07 10:01:35 +01:00
|
|
|
AC_MSG_FAILURE([no])
|
2015-11-18 23:40:52 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-07 10:01:35 +01:00
|
|
|
# Check for nasm and nasm features
|
|
|
|
AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
|
|
|
|
if test "$HAVE_NASM" = "no"; then
|
|
|
|
AC_MSG_RESULT([no nasm])
|
|
|
|
else
|
|
|
|
AC_MSG_CHECKING([for modern nasm])
|
|
|
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
|
|
|
|
sed -i -e '/pblendvb/!d' conftest.c
|
|
|
|
if nasm -f elf64 conftest.c 2> /dev/null; then
|
|
|
|
with_modern_nasm=yes
|
2015-11-18 23:40:52 +01:00
|
|
|
AC_MSG_RESULT([yes])
|
2018-12-07 10:01:35 +01:00
|
|
|
AC_MSG_CHECKING([for optional nasm AVX512 support])
|
|
|
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[vinserti32x8 zmm0, ymm1, 1;]])])
|
|
|
|
sed -i -e '/vinsert/!d' conftest.c
|
|
|
|
if nasm -f elf64 conftest.c 2> /dev/null; then
|
|
|
|
nasm_knows_avx512=yes
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
2015-11-18 23:40:52 +01:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-07 10:01:35 +01:00
|
|
|
# Pick an assembler yasm or nasm
|
|
|
|
if test x"$AS" = x""; then
|
|
|
|
if test x"$yasm_knows_avx512" = x"yes"; then
|
|
|
|
AS=yasm
|
|
|
|
elif test x"$nasm_knows_avx512" = x"yes"; then
|
|
|
|
AS=nasm
|
|
|
|
elif test x"$with_modern_yasm" = x"yes"; then
|
|
|
|
AS=yasm
|
|
|
|
elif test x"$with_modern_nasm" = x"yes"; then
|
|
|
|
AS=nasm
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([No modern yasm or nasm found as required. Yasm should be 1.2.0 or later, and nasm should be v2.11.01 or later (v2.13 for AVX512).])
|
|
|
|
fi
|
|
|
|
fi
|
2019-01-26 01:03:37 +01:00
|
|
|
|
|
|
|
case $host_os in
|
|
|
|
*linux*) arch=linux yasm_args="-f elf64";;
|
|
|
|
*darwin*) arch=darwin yasm_args="-f macho64 --prefix=_ ";;
|
|
|
|
*netbsd*) arch=netbsd yasm_args="-f elf64";;
|
|
|
|
*mingw*) arch=mingw yasm_args="-f win64";;
|
|
|
|
*) arch=unknown yasm_args="-f elf64";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Fix for nasm missing windows features
|
|
|
|
if test x"$arch" = x"mingw"; then
|
|
|
|
if test x"$with_modern_yasm" = x"yes"; then
|
|
|
|
AS=yasm
|
|
|
|
if test x"$yasm_knows_avx512" = x"yes"; then
|
|
|
|
have_as_knows_avx512=yes
|
|
|
|
else
|
|
|
|
have_as_knows_avx512=no
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Mingw build requires Yasm 1.2.0 or later.])
|
|
|
|
fi
|
|
|
|
fi
|
2018-12-07 10:01:35 +01:00
|
|
|
|
|
|
|
if test \( x"$AS" = x"yasm" -a x"$yasm_knows_avx512" = x"yes" \) -o \( x"$AS" = x"nasm" -a x"$nasm_knows_avx512" = x"yes" \); then
|
|
|
|
AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
|
|
|
|
have_as_knows_avx512=yes
|
2015-11-18 23:40:52 +01:00
|
|
|
else
|
2018-12-07 10:01:35 +01:00
|
|
|
AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
|
2015-11-18 23:40:52 +01:00
|
|
|
fi
|
|
|
|
|
2019-01-26 01:03:37 +01:00
|
|
|
AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
|
|
|
|
AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
|
|
|
|
AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
|
|
|
|
AC_SUBST([yasm_args])
|
|
|
|
AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
|
|
|
|
AC_MSG_RESULT([Using $AS args target "$arch" "$yasm_args"])
|
2019-02-11 11:18:30 +01:00
|
|
|
else
|
|
|
|
# Disable below conditionals if not x86
|
|
|
|
AM_CONDITIONAL(USE_YASM, test "x" = "y")
|
|
|
|
AM_CONDITIONAL(USE_NASM, test "x" = "y")
|
|
|
|
AM_CONDITIONAL(WITH_AVX512, test "x" = "y")
|
|
|
|
AM_CONDITIONAL(DARWIN, test "x" = "y")
|
2019-01-26 01:03:37 +01:00
|
|
|
fi
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Check for header files
|
|
|
|
AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
|
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_INLINE
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_UINT16_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
AC_TYPE_UINT8_T
|
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
AC_FUNC_MALLOC # Used only in tests
|
2019-03-05 19:13:03 +01:00
|
|
|
AC_CHECK_FUNCS([memmove memset getopt])
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
my_CFLAGS="\
|
|
|
|
-Wall \
|
|
|
|
-Wchar-subscripts \
|
|
|
|
-Wformat-security \
|
|
|
|
-Wnested-externs \
|
|
|
|
-Wpointer-arith \
|
|
|
|
-Wshadow \
|
|
|
|
-Wstrict-prototypes \
|
|
|
|
-Wtype-limits \
|
|
|
|
"
|
|
|
|
AC_SUBST([my_CFLAGS])
|
|
|
|
|
|
|
|
AC_CONFIG_FILES([\
|
|
|
|
Makefile\
|
|
|
|
libisal.pc
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_OUTPUT
|
|
|
|
AC_MSG_RESULT([
|
|
|
|
$PACKAGE $VERSION
|
|
|
|
=====
|
|
|
|
|
|
|
|
prefix: ${prefix}
|
|
|
|
sysconfdir: ${sysconfdir}
|
|
|
|
libdir: ${libdir}
|
|
|
|
includedir: ${includedir}
|
|
|
|
|
|
|
|
compiler: ${CC}
|
|
|
|
cflags: ${CFLAGS}
|
|
|
|
ldflags: ${LDFLAGS}
|
|
|
|
|
|
|
|
debug: ${enable_debug}
|
|
|
|
])
|