]> git.proxmox.com Git - ceph.git/blob - ceph/src/isa-l/configure.ac
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / isa-l / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.69)
5 AC_INIT([libisal],
6 [2.30.0],
7 [sg.support.isal@intel.com],
8 [isa-l],
9 [http://01.org/storage-acceleration-library])
10 AC_CONFIG_SRCDIR([])
11 AC_CONFIG_AUX_DIR([build-aux])
12 AM_INIT_AUTOMAKE([
13 foreign
14 1.11
15 -Wall
16 -Wno-portability
17 silent-rules
18 tar-pax
19 no-dist-gzip
20 dist-xz
21 subdir-objects
22 ])
23 AM_PROG_AS
24
25 AC_CANONICAL_HOST
26 CPU=""
27 AS_CASE([$host_cpu],
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"],
35 )
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"])
41
42 if test "$CPU" = "x86_64"; then
43 is_x86=yes
44 else
45 if test "$CPU" = "x86_32"; then
46 is_x86=yes
47 else
48 is_x86=no
49 fi
50 fi
51
52 # Check for programs
53 AC_PROG_CC_STDC
54 AC_PROG_LD
55 AC_USE_SYSTEM_EXTENSIONS
56 AM_SILENT_RULES([yes])
57 LT_INIT
58 AC_PREFIX_DEFAULT([/usr])
59 AC_PROG_SED
60 AC_PROG_MKDIR_P
61
62 # Options
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.])
68 ])
69
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])
73 AC_TRY_COMPILE([],[
74 #ifndef __CET__
75 # error CET is not enabled
76 #endif],
77 [AC_MSG_RESULT([yes])
78 intel_cet_enabled=yes],
79 [AC_MSG_RESULT([no])
80 intel_cet_enabled=no])
81
82
83 # Pick an assembler yasm or nasm
84 if test x"$AS" = x""; then
85 # Check for yasm and yasm features
86 yasm_feature_level=0
87 AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
88 if test "$HAVE_YASM" = "yes"; then
89 yasm_feature_level=1
90 else
91 AC_MSG_RESULT([no yasm])
92 fi
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
97 AC_MSG_RESULT([yes])
98 yasm_feature_level=4
99 else
100 AC_MSG_RESULT([no])
101 fi
102 fi
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
107 AC_MSG_RESULT([yes])
108 yasm_feature_level=6
109 else
110 AC_MSG_RESULT([no])
111 fi
112 fi
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
118 AC_MSG_RESULT([yes])
119 yasm_feature_level=10
120 else
121 AC_MSG_RESULT([no])
122 fi
123 fi
124
125 # Check for nasm and nasm features
126 nasm_feature_level=0
127 AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
128 if test "$HAVE_NASM" = "yes"; then
129 nasm_feature_level=1
130 else
131 AC_MSG_RESULT([no nasm])
132 fi
133
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
139 AC_MSG_RESULT([yes])
140 nasm_feature_level=4
141 else
142 AC_MSG_RESULT([no])
143 fi
144 fi
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
150 AC_MSG_RESULT([yes])
151 nasm_feature_level=6
152 else
153 AC_MSG_RESULT([no])
154 fi
155 fi
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
161 AC_MSG_RESULT([yes])
162 nasm_feature_level=10
163 else
164 AC_MSG_RESULT([no])
165 fi
166 fi
167
168 if test $nasm_feature_level -ge $yasm_feature_level ; then
169 AS=nasm
170 as_feature_level=$nasm_feature_level
171 else
172 AS=yasm
173 as_feature_level=$yasm_feature_level
174 fi
175
176 else
177 # Check for $AS supported features
178 as_feature_level=0
179 AC_CHECK_PROG(HAVE_AS, $AS, yes, no)
180 if test "$HAVE_AS" = "yes"; then
181 as_feature_level=1
182 else
183 AC_MSG_ERROR([no $AS])
184 fi
185
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
191 AC_MSG_RESULT([yes])
192 as_feature_level=4
193 else
194 AC_MSG_RESULT([no])
195 fi
196 fi
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
202 AC_MSG_RESULT([yes])
203 as_feature_level=6
204 else
205 AC_MSG_RESULT([no])
206 fi
207 fi
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
213 AC_MSG_RESULT([yes])
214 as_feature_level=10
215 else
216 AC_MSG_RESULT([no])
217 fi
218 fi
219 fi
220
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.])
223 fi
224
225 case $host_os in
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";;
231 esac
232
233 # Fix for nasm missing windows features
234 if test x"$arch" = x"mingw"; then
235 AS=yasm
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.])
239 fi
240 fi
241
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
246 else
247 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
248 fi
249
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"])
256 else
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")
262 fi
263
264 AM_CONDITIONAL(INTEL_CET_ENABLED, [test x"$intel_cet_enabled" = x"yes"])
265
266 # Check for header files
267 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
268
269 # Checks for typedefs, structures, and compiler characteristics.
270 AC_C_INLINE
271 AC_TYPE_SIZE_T
272 AC_TYPE_UINT16_T
273 AC_TYPE_UINT32_T
274 AC_TYPE_UINT64_T
275 AC_TYPE_UINT8_T
276
277 # Checks for library functions.
278 AC_FUNC_MALLOC # Used only in tests
279 AC_CHECK_FUNCS([memmove memset getopt])
280
281 my_CFLAGS="\
282 -Wall \
283 -Wchar-subscripts \
284 -Wformat-security \
285 -Wnested-externs \
286 -Wpointer-arith \
287 -Wshadow \
288 -Wstrict-prototypes \
289 -Wtype-limits \
290 "
291 AC_SUBST([my_CFLAGS])
292
293 AC_CONFIG_FILES([\
294 Makefile\
295 libisal.pc
296 ])
297
298 AC_OUTPUT
299 AC_MSG_RESULT([
300 $PACKAGE $VERSION
301 =====
302
303 prefix: ${prefix}
304 sysconfdir: ${sysconfdir}
305 libdir: ${libdir}
306 includedir: ${includedir}
307
308 compiler: ${CC}
309 cflags: ${CFLAGS}
310 ldflags: ${LDFLAGS}
311
312 debug: ${enable_debug}
313 ])