2 # Process this file with autoconf to produce a configure script.
7 [sg.support.isal@intel.com],
9 [http://01.org/storage-acceleration-library])
11 AC_CONFIG_AUX_DIR([build-aux])
27 AC_USE_SYSTEM_EXTENSIONS
28 AM_SILENT_RULES([yes])
30 AC_PREFIX_DEFAULT([/usr])
35 AC_ARG_ENABLE([debug],
36 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
37 [], [enable_debug=no])
38 AS_IF([test "x$enable_debug" = "xyes"], [
39 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
42 # Check for yasm and yasm features
43 AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
44 if test "$HAVE_YASM" = "no"; then
45 AC_MSG_RESULT([no yasm])
47 AC_MSG_CHECKING([for modern yasm])
48 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
49 if yasm -f elf64 -p gas conftest.c ; then
52 AC_MSG_CHECKING([for optional yasm AVX512 support])
53 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
54 if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
65 # Check for nasm and nasm features
66 AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
67 if test "$HAVE_NASM" = "no"; then
68 AC_MSG_RESULT([no nasm])
70 AC_MSG_CHECKING([for modern nasm])
71 AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
72 sed -i -e '/pblendvb/!d' conftest.c
73 if nasm -f elf64 conftest.c 2> /dev/null; then
76 AC_MSG_CHECKING([for optional nasm AVX512 support])
77 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb zmm0, zmm1, zmm2;]])])
78 sed -i -e '/vpshufb/!d' conftest.c
79 if nasm -f elf64 conftest.c 2> /dev/null; then
90 # Pick an assembler yasm or nasm
91 if test x"$AS" == x""; then
92 if test x"$yasm_knows_avx512" = x"yes"; then
94 elif test x"$nasm_knows_avx512" = x"yes"; then
96 elif test x"$with_modern_yasm" = x"yes"; then
98 elif test x"$with_modern_nasm" = x"yes"; then
101 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.])
104 echo "Using assembler $AS"
106 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
107 AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
108 have_as_knows_avx512=yes
110 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
112 AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
113 AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
114 AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
118 *linux*) arch=linux yasm_args="-f elf64";;
119 *darwin*) arch=darwin yasm_args="-f macho64 --prefix=_ ";;
120 *netbsd*) arch=netbsd yasm_args="-f elf64";;
121 *) arch=unknown yasm_args="-f elf64";;
123 AC_SUBST([yasm_args])
124 AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
125 AC_MSG_RESULT([Using yasm args target "$arch" "$yasm_args"])
127 # Check for header files
128 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
130 # Checks for typedefs, structures, and compiler characteristics.
138 # Checks for library functions.
139 AC_FUNC_MALLOC # Used only in tests
140 AC_CHECK_FUNCS([memmove memset])
149 -Wstrict-prototypes \
152 AC_SUBST([my_CFLAGS])
165 sysconfdir: ${sysconfdir}
167 includedir: ${includedir}
173 debug: ${enable_debug}