]> git.proxmox.com Git - ceph.git/blob - ceph/src/isa-l/configure.ac
b2923ea7903afe2965a3c8fc5ab82ccaac991946
[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.16.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 # Check for programs
26 AC_PROG_CC_STDC
27 AC_USE_SYSTEM_EXTENSIONS
28 AM_SILENT_RULES([yes])
29 LT_INIT
30 AC_PREFIX_DEFAULT([/usr])
31 AC_PROG_SED
32 AC_PROG_MKDIR_P
33
34 # Options
35 AC_ARG_ENABLE([debug],
36 AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
37 [], [enable_debug=no])
38 AS_IF([test "x$enable_debug" = "xyes"], [
39 AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
40 ])
41
42 # Check for yasm and yasm features
43 AC_CHECK_PROG(HAVE_YASM, yasm, yes, no)
44 if test "$HAVE_YASM" = "no"; then
45 AC_MSG_RESULT([no yasm])
46 else
47 AC_MSG_CHECKING([for modern yasm])
48 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vmovdqa %xmm0, %xmm1;]])])
49 if yasm -f elf64 -p gas conftest.c ; then
50 with_modern_yasm=yes
51 AC_MSG_RESULT([yes])
52 AC_MSG_CHECKING([for optional yasm AVX512 support])
53 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb %zmm0, %zmm1, %zmm2;]])])
54 if yasm -f elf64 -p gas conftest.c 2> /dev/null; then
55 yasm_knows_avx512=yes
56 AC_MSG_RESULT([yes])
57 else
58 AC_MSG_RESULT([no])
59 fi
60 else
61 AC_MSG_FAILURE([no])
62 fi
63 fi
64
65 # Check for nasm and nasm features
66 AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
67 if test "$HAVE_NASM" = "no"; then
68 AC_MSG_RESULT([no nasm])
69 else
70 AC_MSG_CHECKING([for modern nasm])
71 AC_LANG_CONFTEST([AC_LANG_SOURCE([[pblendvb xmm2, xmm1;]])])
72 sed -i -e '/pblendvb/!d' conftest.c
73 if nasm -f elf64 conftest.c 2> /dev/null; then
74 with_modern_nasm=yes
75 AC_MSG_RESULT([yes])
76 AC_MSG_CHECKING([for optional nasm AVX512 support])
77 AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpshufb zmm0, zmm1, zmm2;]])])
78 sed -i -e '/vpshufb/!d' conftest.c
79 if nasm -f elf64 conftest.c 2> /dev/null; then
80 nasm_knows_avx512=yes
81 AC_MSG_RESULT([yes])
82 else
83 AC_MSG_RESULT([no])
84 fi
85 else
86 AC_MSG_RESULT([no])
87 fi
88 fi
89
90 # Pick an assembler yasm or nasm
91 if test x"$AS" == x""; then
92 if test x"$yasm_knows_avx512" = x"yes"; then
93 AS=yasm
94 elif test x"$nasm_knows_avx512" = x"yes"; then
95 AS=nasm
96 elif test x"$with_modern_yasm" = x"yes"; then
97 AS=yasm
98 elif test x"$with_modern_nasm" = x"yes"; then
99 AS=nasm
100 else
101 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.])
102 fi
103 fi
104 echo "Using assembler $AS"
105
106 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
107 AC_DEFINE(HAVE_AS_KNOWS_AVX512, [1], [Assembler can do AVX512.])
108 have_as_knows_avx512=yes
109 else
110 AC_MSG_RESULT([Assembler does not understand AVX512 opcodes. Consider upgrading for best performance.])
111 fi
112 AM_CONDITIONAL(USE_YASM, test x"$AS" = x"yasm")
113 AM_CONDITIONAL(USE_NASM, test x"$AS" = x"nasm")
114 AM_CONDITIONAL(WITH_AVX512, test x"$have_as_knows_avx512" = x"yes")
115
116
117 case $target in
118 *linux*) arch=linux yasm_args="-f elf64";;
119 *darwin*) arch=darwin yasm_args="-f macho64 --prefix=_ ";;
120 *netbsd*) arch=netbsd yasm_args="-f elf64";;
121 *) arch=unknown yasm_args="-f elf64";;
122 esac
123 AC_SUBST([yasm_args])
124 AM_CONDITIONAL(DARWIN, test x"$arch" = x"darwin")
125 AC_MSG_RESULT([Using yasm args target "$arch" "$yasm_args"])
126
127 # Check for header files
128 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h])
129
130 # Checks for typedefs, structures, and compiler characteristics.
131 AC_C_INLINE
132 AC_TYPE_SIZE_T
133 AC_TYPE_UINT16_T
134 AC_TYPE_UINT32_T
135 AC_TYPE_UINT64_T
136 AC_TYPE_UINT8_T
137
138 # Checks for library functions.
139 AC_FUNC_MALLOC # Used only in tests
140 AC_CHECK_FUNCS([memmove memset])
141
142 my_CFLAGS="\
143 -Wall \
144 -Wchar-subscripts \
145 -Wformat-security \
146 -Wnested-externs \
147 -Wpointer-arith \
148 -Wshadow \
149 -Wstrict-prototypes \
150 -Wtype-limits \
151 "
152 AC_SUBST([my_CFLAGS])
153
154 AC_CONFIG_FILES([\
155 Makefile\
156 libisal.pc
157 ])
158
159 AC_OUTPUT
160 AC_MSG_RESULT([
161 $PACKAGE $VERSION
162 =====
163
164 prefix: ${prefix}
165 sysconfdir: ${sysconfdir}
166 libdir: ${libdir}
167 includedir: ${includedir}
168
169 compiler: ${CC}
170 cflags: ${CFLAGS}
171 ldflags: ${LDFLAGS}
172
173 debug: ${enable_debug}
174 ])