]> git.proxmox.com Git - ceph.git/blame - ceph/src/isa-l/configure.ac
update sources to v12.1.1
[ceph.git] / ceph / src / isa-l / configure.ac
CommitLineData
7c673cae
FG
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.69)
5AC_INIT([libisal],
224ce89b 6 [2.18.0],
7c673cae
FG
7 [sg.support.isal@intel.com],
8 [isa-l],
9 [http://01.org/storage-acceleration-library])
10AC_CONFIG_SRCDIR([])
11AC_CONFIG_AUX_DIR([build-aux])
12AM_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])
23AM_PROG_AS
24
224ce89b
WB
25AC_CANONICAL_HOST
26CPU=""
27AS_CASE([$host_cpu],
28 [x86_64], [CPU="x86_64"],
29 [amd64], [CPU="x86_64"],
30 [i?86], [CPU="x86_32"],
31)
32AM_CONDITIONAL([CPU_X86_64], [test "$CPU" = "x86_64"])
33AM_CONDITIONAL([CPU_X86_32], [test "$CPU" = "x86_32"])
34AM_CONDITIONAL([CPU_UNDEFINED], [test "x$CPU" = "x"])
35
7c673cae
FG
36# Check for programs
37AC_PROG_CC_STDC
38AC_USE_SYSTEM_EXTENSIONS
39AM_SILENT_RULES([yes])
40LT_INIT
41AC_PREFIX_DEFAULT([/usr])
42AC_PROG_SED
43AC_PROG_MKDIR_P
44
45# Options
46AC_ARG_ENABLE([debug],
47 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
48 [], [enable_debug=no])
49AS_IF([test "x$enable_debug" = "xyes"], [
50 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
51])
52
53# Check for yasm and yasm features
54AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
55if test "$HAVE_YASM" = "no"; then
56 AC_MSG_RESULT([no yasm])
57else
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
61 with_modern_yasm=yes
62 AC_MSG_RESULT([yes])
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
66 yasm_knows_avx512=yes
67 AC_MSG_RESULT([yes])
68 else
69 AC_MSG_RESULT([no])
70 fi
71 else
72 AC_MSG_FAILURE([no])
73 fi
74fi
75
76# Check for nasm and nasm features
77AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
78if test "$HAVE_NASM" = "no"; then
79 AC_MSG_RESULT([no nasm])
80else
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
85 with_modern_nasm=yes
86 AC_MSG_RESULT([yes])
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
91 nasm_knows_avx512=yes
92 AC_MSG_RESULT([yes])
93 else
94 AC_MSG_RESULT([no])
95 fi
96 else
97 AC_MSG_RESULT([no])
98 fi
99fi
100
101# Pick an assembler yasm or nasm
224ce89b 102if test x"$AS" = x""; then
7c673cae
FG
103 if test x"$yasm_knows_avx512" = x"yes"; then
104 AS=yasm
105 elif test x"$nasm_knows_avx512" = x"yes"; then
106 AS=nasm
107 elif test x"$with_modern_yasm" = x"yes"; then
108 AS=yasm
109 elif test x"$with_modern_nasm" = x"yes"; then
110 AS=nasm
111 else
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.])
113 fi
114fi
115echo "Using assembler $AS"
116
117if 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
120else
121 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
122fi
123AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
124AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
125AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
126
127
224ce89b 128case $host_os in
7c673cae
FG
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";;
133esac
134AC_SUBST([yasm_args])
135AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
136AC_MSG_RESULT([Using yasm args target "$arch" "$yasm_args"])
137
138# Check for header files
139AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
140
141# Checks for typedefs, structures, and compiler characteristics.
142AC_C_INLINE
143AC_TYPE_SIZE_T
144AC_TYPE_UINT16_T
145AC_TYPE_UINT32_T
146AC_TYPE_UINT64_T
147AC_TYPE_UINT8_T
148
149# Checks for library functions.
150AC_FUNC_MALLOC # Used only in tests
151AC_CHECK_FUNCS([memmove memset])
152
153my_CFLAGS="\
154-Wall \
155-Wchar-subscripts \
156-Wformat-security \
157-Wnested-externs \
158-Wpointer-arith \
159-Wshadow \
160-Wstrict-prototypes \
161-Wtype-limits \
162"
163AC_SUBST([my_CFLAGS])
164
165AC_CONFIG_FILES([\
166 Makefile\
167 libisal.pc
168])
169
170AC_OUTPUT
171AC_MSG_RESULT([
172 $PACKAGE $VERSION
173 =====
174
175 prefix: ${prefix}
176 sysconfdir: ${sysconfdir}
177 libdir: ${libdir}
178 includedir: ${includedir}
179
180 compiler: ${CC}
181 cflags: ${CFLAGS}
182 ldflags: ${LDFLAGS}
183
184 debug: ${enable_debug}
185])