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])
28 [x86_64], [CPU="x86_64"],
29 [amd64], [CPU="x86_64"],
30 [i?86], [CPU="x86_32"],
32 AM_CONDITIONAL([CPU_X86_64], [test "$CPU" = "x86_64"])
33 AM_CONDITIONAL([CPU_X86_32], [test "$CPU" = "x86_32"])
34 AM_CONDITIONAL([CPU_UNDEFINED], [test "x$CPU" = "x"])
38 AC_USE_SYSTEM_EXTENSIONS
39 AM_SILENT_RULES([yes])
41 AC_PREFIX_DEFAULT([/usr])
46 AC_ARG_ENABLE([debug],
47 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
48 [], [enable_debug=no])
49 AS_IF([test "x$enable_debug" = "xyes"], [
50 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
53 # Check for yasm and yasm features
54 AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
55 if test "$HAVE_YASM" = "no"; then
56 AC_MSG_RESULT([no yasm])
58 AC_MSG_CHECKING([for modern yasm])
59 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
60 if yasm -f elf64 -p gas conftest.c ; then
63 AC_MSG_CHECKING([for optional yasm AVX512 support])
64 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
65 if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
76 # Check for nasm and nasm features
77 AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
78 if test "$HAVE_NASM" = "no"; then
79 AC_MSG_RESULT([no nasm])
81 AC_MSG_CHECKING([for modern nasm])
82 AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
83 sed -i -e '/pblendvb/!d' conftest.c
84 if nasm -f elf64 conftest.c 2> /dev/null; then
87 AC_MSG_CHECKING([for optional nasm AVX512 support])
88 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb zmm0, zmm1, zmm2;]])])
89 sed -i -e '/vpshufb/!d' conftest.c
90 if nasm -f elf64 conftest.c 2> /dev/null; then
101 # Pick an assembler yasm or nasm
102 if test x"$AS" = x""; then
103 if test x"$yasm_knows_avx512" = x"yes"; then
105 elif test x"$nasm_knows_avx512" = x"yes"; then
107 elif test x"$with_modern_yasm" = x"yes"; then
109 elif test x"$with_modern_nasm" = x"yes"; then
112 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.])
115 echo "Using assembler $AS"
117 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
118 AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
119 have_as_knows_avx512=yes
121 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
123 AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
124 AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
125 AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
129 *linux*) arch=linux yasm_args="-f elf64";;
130 *darwin*) arch=darwin yasm_args="-f macho64 --prefix=_ ";;
131 *netbsd*) arch=netbsd yasm_args="-f elf64";;
132 *) arch=unknown yasm_args="-f elf64";;
134 AC_SUBST([yasm_args])
135 AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
136 AC_MSG_RESULT([Using yasm args target "$arch" "$yasm_args"])
138 # Check for header files
139 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
141 # Checks for typedefs, structures, and compiler characteristics.
149 # Checks for library functions.
150 AC_FUNC_MALLOC # Used only in tests
151 AC_CHECK_FUNCS([memmove memset])
160 -Wstrict-prototypes \
163 AC_SUBST([my_CFLAGS])
176 sysconfdir: ${sysconfdir}
178 includedir: ${includedir}
184 debug: ${enable_debug}