]> git.proxmox.com Git - ceph.git/blob - ceph/src/isa-l/configure.ac
update sources to v12.1.1
[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.18.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 )
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"])
35
36 # Check for programs
37 AC_PROG_CC_STDC
38 AC_USE_SYSTEM_EXTENSIONS
39 AM_SILENT_RULES([yes])
40 LT_INIT
41 AC_PREFIX_DEFAULT([/usr])
42 AC_PROG_SED
43 AC_PROG_MKDIR_P
44
45 # Options
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.])
51 ])
52
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])
57 else
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
74 fi
75
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])
80 else
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
99 fi
100
101 # Pick an assembler yasm or nasm
102 if test x"$AS" = x""; then
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
114 fi
115 echo "Using assembler $AS"
116
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
120 else
121 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
122 fi
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")
126
127
128 case $host_os in
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";;
133 esac
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"])
137
138 # Check for header files
139 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
140
141 # Checks for typedefs, structures, and compiler characteristics.
142 AC_C_INLINE
143 AC_TYPE_SIZE_T
144 AC_TYPE_UINT16_T
145 AC_TYPE_UINT32_T
146 AC_TYPE_UINT64_T
147 AC_TYPE_UINT8_T
148
149 # Checks for library functions.
150 AC_FUNC_MALLOC # Used only in tests
151 AC_CHECK_FUNCS([memmove memset])
152
153 my_CFLAGS="\
154 -Wall \
155 -Wchar-subscripts \
156 -Wformat-security \
157 -Wnested-externs \
158 -Wpointer-arith \
159 -Wshadow \
160 -Wstrict-prototypes \
161 -Wtype-limits \
162 "
163 AC_SUBST([my_CFLAGS])
164
165 AC_CONFIG_FILES([\
166 Makefile\
167 libisal.pc
168 ])
169
170 AC_OUTPUT
171 AC_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 ])