3 AC_CONFIG_SRCDIR([main.c])
8 # NOTE: this script intentionally doesn't check for small details like posix functions and hard dependencies (libsodium) so you may get errors at compilation
10 if test "x$oldcflags" != "x$CFLAGS"
13 CFLAGS="-march=native"
14 AC_MSG_CHECKING([whether CC supports -march=native])
15 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
16 [AC_MSG_RESULT([yes])]
17 [oldcflags="$oldcflags -march=native"],
20 CFLAGS="-fomit-frame-pointer"
21 AC_MSG_CHECKING([whether CC supports -fomit-frame-pointer])
22 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
23 [AC_MSG_RESULT([yes])]
24 [oldcflags="$oldcflags -fomit-frame-pointer"],
34 AC_MSG_CHECKING([whether CC supports -nopie])
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
36 [AC_MSG_RESULT([yes])]
42 if test "x$nopie" = "x"
46 AC_MSG_CHECKING([whether CC supports -no-pie])
47 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
48 [AC_MSG_RESULT([yes])]
59 AC_ARG_ENABLE([ref10],
60 [AS_HELP_STRING([--enable-ref10],
61 [use SUPERCOP ref10 ed25519 implementation @<:@default=yes@:>@])],
63 AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "ref10"],
64 [AC_ERROR([only one ed25519 implementation can be defined])])
70 AC_ARG_ENABLE([amd64-51-30k],
71 [AS_HELP_STRING([--enable-amd64-51-30k],
72 [use SUPERCOP amd64-51-30k ed25519 implementation @<:@default=no@:>@])],
74 AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "amd64_51_30k"],
75 [AC_ERROR([only one ed25519 implementation can be defined])])
76 ed25519impl="amd64_51_30k"
81 AC_ARG_ENABLE([amd64-64-24k],
82 [AS_HELP_STRING([--enable-amd64-64-24k],
83 [use SUPERCOP amd64-64-24k ed25519 implementation @<:@default=no@:>@])],
85 AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "amd64_64_24k"],
86 [AC_ERROR([only one ed25519 implementation can be defined])])
87 ed25519impl="amd64_64_24k"
92 AC_ARG_ENABLE([donna],
93 [AS_HELP_STRING([--enable-donna],
94 [use ed25519-donna implementation @<:@default=no@:>@])],
96 AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "donna"],
97 [AC_ERROR([only one ed25519 implementation can be defined])])
103 AC_ARG_ENABLE([donna-sse2],
104 [AS_HELP_STRING([--enable-donna-sse2],
105 [use ed25519-donna SSE2 implementation @<:@default=no@:>@])],
107 AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "donna-sse2"],
108 [AC_ERROR([only one ed25519 implementation can be defined])])
109 ed25519impl="donna-sse2"
114 AS_IF([test "x$ed25519impl" == "x"],[ed25519impl=ref10])
116 if test "$ed25519impl" = "donna-sse2"
119 MYDEFS="$MYDEFS -DED25519_SSE2"
120 CFLAGS="$CFLAGS -msse2"
123 AC_ARG_ENABLE([intfilter],
124 [AS_HELP_STRING([--enable-intfilter@<:@=(32|64|128|native)@:>@],
125 [use integers of specific size @<:@default=64@:>@ for filtering. faster but limits filter length to: 6 for 32-bit, 12 for 64-bit, 24 for 128-bit @<:@default=no@:>@])],
126 [], [enable_intfilter=no]
128 AC_ARG_ENABLE([intfilter32],
129 [AS_HELP_STRING([--enable-intfilter32], [deprecated. use --enable-intfilter=32 instead])],
130 [enable_intfilter=32]
131 [AC_MSG_WARN([--enable-intfilter32 option is deprecated. use --enable-intfilter=32 instead])],
134 case "$enable_intfilter" in
142 intfiltertype="unsigned __int128"
145 intfiltertype="size_t"
151 AC_MSG_WARN([unrecognised intfilter type: $enable_intfilter])
156 if test -n "$intfiltertype"
158 MYDEFS="$MYDEFS -DINTFILTER -DIFT='$intfiltertype'"
161 AC_ARG_ENABLE([batchnum],
162 [AS_HELP_STRING([--enable-batchnum=number],
163 [number of elements to batch when using -B @<:@default=2048@:>@])],
166 if test -n "$enable_batchnum" -a x"$enable_batchnum" != x"no"
168 MYDEFS="$MYDEFS -DBATCHNUM=$enable_batchnum"
175 AC_MSG_CHECKING([whether CC supports -std=c99])
176 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
177 [AC_MSG_RESULT([yes])]
180 [AC_MSG_RESULT([no])]
183 AC_MSG_CHECKING([whether CC supports -Wall])
184 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
185 [AC_MSG_RESULT([yes])]
186 [cstd="$cstd -Wall"],
187 [AC_MSG_RESULT([no])]
189 CFLAGS="$cstd -Wno-maybe-uninitialized"
190 AC_MSG_CHECKING([whether CC supports -Wno-maybe-uninitialized])
191 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
192 [AC_MSG_RESULT([yes])]
193 [cstd="$cstd -Wno-maybe-uninitialized"],
194 [AC_MSG_RESULT([no])]
196 if test "x$c99" = "xyes" -a "x$ed25519impl" != "xdonna" -a "x$enable_intfilter" != "x128"
198 CFLAGS="$cstd -pedantic"
199 AC_MSG_CHECKING([whether CC supports -pedantic])
200 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
201 [AC_MSG_RESULT([yes])]
202 [cstd="$cstd -pedantic"],
203 [AC_MSG_RESULT([no])]
206 if test "x$ed25519impl" = "xdonna"
208 CFLAGS="$cstd -Wno-unused-function"
209 AC_MSG_CHECKING([whether CC supports -Wno-unused-function])
210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
211 [AC_MSG_RESULT([yes])]
212 [cstd="$cstd -Wno-unused-function"],
213 [AC_MSG_RESULT([no])]
218 AC_ARG_ENABLE([binfilterlen],
219 [AS_HELP_STRING([--enable-binfilterlen=VAL],
220 [set binary string filter length (if you don't use intfilter) @<:@default=32@:>@])],
221 [], [enable_binfilterlen=no]
223 if test "x$enable_binfilterlen" != "xyes" -a "x$enable_binfilterlen" != "xno"
225 MYDEFS="$MYDEFS -DBINFILTERLEN=$enable_binfilterlen"
228 AC_ARG_ENABLE([binsearch],
229 [AS_HELP_STRING([--enable-binsearch],
230 [enable binary search algoritm; MUCH faster if there are a lot of filters @<:@default=no@:>@])],
231 [], [enable_binsearch=no]
233 if test "x$enable_binsearch" = "xyes"
235 MYDEFS="$MYDEFS -DBINSEARCH"
238 AC_ARG_ENABLE([besort],
239 [AS_HELP_STRING([--enable-besort],
240 [force intfilter binsearch case to use big endian sorting and not omit masks from filters; useful if your filters aren't of same length @<:@default=no@:>@])],
241 [], [enable_besort=no]
243 if test "x$enable_besort" = "xyes"
245 MYDEFS="$MYDEFS -DBESORT"
248 AC_ARG_ENABLE([statistics],
249 [AS_HELP_STRING([--enable-statistics],
250 [collect statistics @<:@default=yes@:>@])],
251 [], [enable_statistics=yes]
253 if test "x$enable_statistics" = "xyes"
255 MYDEFS="$MYDEFS -DSTATISTICS"
258 AC_ARG_WITH([pcre2],[AC_HELP_STRING([--with-pcre2],[pcre2-config executable @<:@default=pcre2-config@:>@])],[],[with_pcre2="pcre2-config"])
260 AC_ARG_ENABLE([regex],[AC_HELP_STRING([--enable-regex],[whether to enable regex engine. currently possible values are "pcre2" and "yes" which defaults to "pcre2" @<:@default=no@:>@])],[],[enable_regex=no])
261 case "$enable_regex" in
265 AC_MSG_CHECKING([pcre2])
267 if test "$with_pcre2" != "yes"
269 V=`"$with_pcre2" --version 2>/dev/null`
274 MYDEFS="$MYDEFS -DPCRE2FILTER"
275 CF=`"$with_pcre2" --cflags`
280 LF=`"$with_pcre2" --libs8`
283 MAINLIB="$MAINLIB $LF"
286 AC_MSG_RESULT([not found])
287 AC_ERROR([pcre2-config cannot be executed])
291 AC_MSG_WARN([unrecognised regex engine type: $enable_regex])
295 AC_SUBST(CSTD,["$cstd"])
296 AC_SUBST(ED25519IMPL,["$ed25519impl"])
297 AC_SUBST(MYDEFS,["$MYDEFS"])
298 AC_SUBST(MAINLIB,["$MAINLIB"])
299 AC_SUBST(NOPIE,["$nopie"])