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'"
165 AC_MSG_CHECKING([whether CC supports -std=c99])
166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
167 [AC_MSG_RESULT([yes])]
170 [AC_MSG_RESULT([no])]
173 AC_MSG_CHECKING([whether CC supports -Wall])
174 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
175 [AC_MSG_RESULT([yes])]
176 [cstd="$cstd -Wall"],
177 [AC_MSG_RESULT([no])]
179 if test "x$c99" = "xyes" -a "x$ed25519impl" != "xdonna" -a "x$enable_intfilter" != "x128"
181 CFLAGS="$cstd -pedantic"
182 AC_MSG_CHECKING([whether CC supports -pedantic])
183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
184 [AC_MSG_RESULT([yes])]
185 [cstd="$cstd -pedantic"],
186 [AC_MSG_RESULT([no])]
189 if test "x$ed25519impl" = "xdonna"
191 CFLAGS="$cstd -Wno-unused-function"
192 AC_MSG_CHECKING([whether CC supports -Wno-unused-function])
193 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
194 [AC_MSG_RESULT([yes])]
195 [cstd="$cstd -Wno-unused-function"],
196 [AC_MSG_RESULT([no])]
201 AC_ARG_ENABLE([binfilterlen],
202 [AS_HELP_STRING([--enable-binfilterlen=VAL],
203 [set binary string filter length (if you don't use intfilter) @<:@default=32@:>@])],
204 [], [enable_binfilterlen=no]
206 if test "x$enable_binfilterlen" != "xyes" -a "x$enable_binfilterlen" != "xno"
208 MYDEFS="$MYDEFS -DBINFILTERLEN=$enable_binfilterlen"
211 AC_ARG_ENABLE([binsearch],
212 [AS_HELP_STRING([--enable-binsearch],
213 [enable binary search algoritm; MUCH faster if there are a lot of filters @<:@default=no@:>@])],
214 [], [enable_binsearch=no]
216 if test "x$enable_binsearch" = "xyes"
218 MYDEFS="$MYDEFS -DBINSEARCH"
221 AC_ARG_ENABLE([besort],
222 [AS_HELP_STRING([--enable-besort],
223 [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@:>@])],
224 [], [enable_besort=no]
226 if test "x$enable_besort" = "xyes"
228 MYDEFS="$MYDEFS -DBESORT"
231 AC_ARG_ENABLE([statistics],
232 [AS_HELP_STRING([--enable-statistics],
233 [collect statistics @<:@default=yes@:>@])],
234 [], [enable_statistics=yes]
236 if test "x$enable_statistics" = "xyes"
238 MYDEFS="$MYDEFS -DSTATISTICS"
241 AC_ARG_WITH([pcre2],[AC_HELP_STRING([--with-pcre2],[pcre2-config executable @<:@default=pcre2-config@:>@])],[],[with_pcre2="pcre2-config"])
243 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])
244 case "$enable_regex" in
248 AC_MSG_CHECKING([pcre2])
250 if test "$with_pcre2" != "yes"
252 V=`"$with_pcre2" --version 2>/dev/null`
257 MYDEFS="$MYDEFS -DPCRE2FILTER"
258 CF=`"$with_pcre2" --cflags`
263 LF=`"$with_pcre2" --libs8`
266 MAINLIB="$MAINLIB $LF"
269 AC_MSG_RESULT([not found])
270 AC_ERROR([pcre2-config cannot be executed])
274 AC_MSG_WARN([unrecognised regex engine type: $enable_regex])
278 AC_SUBST(CSTD,["$cstd"])
279 AC_SUBST(ED25519IMPL,["$ed25519impl"])
280 AC_SUBST(MYDEFS,["$MYDEFS"])
281 AC_SUBST(MAINLIB,["$MAINLIB"])
282 AC_SUBST(NOPIE,["$nopie"])