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"],
31 [aarch64], [CPU="aarch64"],
32 [arm64], [CPU="aarch64"],
33 [powerpc64le], [CPU="ppc64le"],
34 [ppc64le], [CPU="ppc64le"],
36 AM_CONDITIONAL([CPU_X86_64], [test "$CPU" = "x86_64"])
37 AM_CONDITIONAL([CPU_X86_32], [test "$CPU" = "x86_32"])
38 AM_CONDITIONAL([CPU_AARCH64], [test "$CPU" = "aarch64"])
39 AM_CONDITIONAL([CPU_PPC64LE], [test "$CPU" = "ppc64le"])
40 AM_CONDITIONAL([CPU_UNDEFINED], [test "x$CPU" = "x"])
42 if test "$CPU" = "x86_64"; then
45 if test "$CPU" = "x86_32"; then
55 AC_USE_SYSTEM_EXTENSIONS
56 AM_SILENT_RULES([yes])
58 AC_PREFIX_DEFAULT([/usr])
63 AC_ARG_ENABLE([debug],
64 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
65 [], [enable_debug=no])
66 AS_IF([test "x$enable_debug" = "xyes"], [
67 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
70 # If this build is for x86, look for yasm and nasm
71 if test x"$is_x86" = x"yes"; then
72 AC_MSG_CHECKING([whether Intel CET is enabled])
75 # error CET is not enabled
78 intel_cet_enabled=yes],
80 intel_cet_enabled=no])
83 # Pick an assembler yasm or nasm
84 if test x"$AS" = x""; then
85 # Check for yasm and yasm features
87 AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
88 if test "$HAVE_YASM" = "yes"; then
91 AC_MSG_RESULT([no yasm])
93 if test x"$yasm_feature_level" = x"1"; then
94 AC_MSG_CHECKING([for modern yasm])
95 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
96 if yasm -f elf64 -p gas conftest.c ; then
103 if test x"$yasm_feature_level" = x"4"; then
104 AC_MSG_CHECKING([for optional yasm AVX512 support])
105 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
106 if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
113 if test x"$yasm_feature_level" = x"6"; then
114 AC_MSG_CHECKING([for additional yasm AVX512 support])
115 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0, k1, zmm1;]])])
116 sed -i -e '/vpcompressb/!d' conftest.c
117 if yasm -f elf64 conftest.c 2> /dev/null; then
119 yasm_feature_level=10
125 # Check for nasm and nasm features
127 AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
128 if test "$HAVE_NASM" = "yes"; then
131 AC_MSG_RESULT([no nasm])
134 if test x"$nasm_feature_level" = x"1"; then
135 AC_MSG_CHECKING([for modern nasm])
136 AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
137 sed -i -e '/pblendvb/!d' conftest.c
138 if nasm -f elf64 conftest.c 2> /dev/null; then
145 if test x"$nasm_feature_level" = x"4"; then
146 AC_MSG_CHECKING([for optional nasm AVX512 support])
147 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vinserti32x8 zmm0, ymm1, 1;]])])
148 sed -i -e '/vinsert/!d' conftest.c
149 if nasm -f elf64 conftest.c 2> /dev/null; then
156 if test x"$nasm_feature_level" = x"6"; then
157 AC_MSG_CHECKING([for additional nasm AVX512 support])
158 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0 {k1}, zmm1;]])])
159 sed -i -e '/vpcompressb/!d' conftest.c
160 if nasm -f elf64 conftest.c 2> /dev/null; then
162 nasm_feature_level=10
168 if test $nasm_feature_level -ge $yasm_feature_level ; then
170 as_feature_level=$nasm_feature_level
173 as_feature_level=$yasm_feature_level
177 # Check for $AS supported features
179 AC_CHECK_PROG(HAVE_AS, $AS, yes, no)
180 if test "$HAVE_AS" = "yes"; then
183 AC_MSG_ERROR([no $AS])
186 if test x"$as_feature_level" = x"1"; then
187 AC_MSG_CHECKING([for modern $AS])
188 AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
189 sed -i -e '/pblendvb/!d' conftest.c
190 if $AS -f elf64 conftest.c 2> /dev/null; then
197 if test x"$as_feature_level" = x"4"; then
198 AC_MSG_CHECKING([for optional as AVX512 support])
199 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vinserti32x8 zmm0, ymm1, 1;]])])
200 sed -i -e '/vinsert/!d' conftest.c
201 if $AS -f elf64 conftest.c 2> /dev/null; then
208 if test x"$as_feature_level" = x"6"; then
209 AC_MSG_CHECKING([for additional as AVX512 support])
210 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0, k1, zmm1;]])])
211 sed -i -e '/vpcompressb/!d' conftest.c
212 if $AS -f elf64 conftest.c 2> /dev/null; then
221 if test $as_feature_level -lt 2 ; then
222 AC_MSG_ERROR([No modern nasm or yasm found as required. Nasm should be v2.11.01 or later (v2.13 for AVX512) and yasm should be 1.2.0 or later.])
226 *linux*) arch=linux yasm_args="-f elf64";;
227 *darwin*) arch=darwin yasm_args="-f macho64 --prefix=_ ";;
228 *netbsd*) arch=netbsd yasm_args="-f elf64";;
229 *mingw*) arch=mingw yasm_args="-f win64";;
230 *) arch=unknown yasm_args="-f elf64";;
233 # Fix for nasm missing windows features
234 if test x"$arch" = x"mingw"; then
236 as_feature_level=$yasm_feature_level
237 if test $as_feature_level -lt 2 ; then
238 AC_MSG_ERROR([Mingw build requires Yasm 1.2.0 or later.])
242 AC_DEFINE_UNQUOTED(AS_FEATURE_LEVEL, [$as_feature_level], [Assembler feature level.])
243 if test $as_feature_level -ge 6 ; then
244 AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
245 have_as_knows_avx512=yes
247 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
250 AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
251 AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
252 AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
253 AC_SUBST([yasm_args])
254 AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
255 AC_MSG_RESULT([Using $AS args target "$arch" "$yasm_args"])
257 # Disable below conditionals if not x86
258 AM_CONDITIONAL(USE_YASM, test "x" = "y")
259 AM_CONDITIONAL(USE_NASM, test "x" = "y")
260 AM_CONDITIONAL(WITH_AVX512, test "x" = "y")
261 AM_CONDITIONAL(DARWIN, test "x" = "y")
264 AM_CONDITIONAL(INTEL_CET_ENABLED, [test x"$intel_cet_enabled" = x"yes"])
266 # Check for header files
267 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
269 # Checks for typedefs, structures, and compiler characteristics.
277 # Checks for library functions.
278 AC_FUNC_MALLOC # Used only in tests
279 AC_CHECK_FUNCS([memmove memset getopt])
288 -Wstrict-prototypes \
291 AC_SUBST([my_CFLAGS])
304 sysconfdir: ${sysconfdir}
306 includedir: ${includedir}
312 debug: ${enable_debug}