2017-09-27 01:35:56 +02:00
|
|
|
AC_INIT(mkp224o)
|
2017-09-27 20:07:33 +02:00
|
|
|
# sanity check
|
2017-09-27 01:35:56 +02:00
|
|
|
AC_CONFIG_SRCDIR([main.c])
|
|
|
|
# C compiler
|
2017-10-06 02:59:19 +02:00
|
|
|
oldcflags="$CFLAGS"
|
2017-09-27 01:35:56 +02:00
|
|
|
AC_PROG_CC
|
2017-09-27 03:07:41 +02:00
|
|
|
|
2017-10-06 02:59:19 +02:00
|
|
|
if test "x$oldcflags" != "x$CFLAGS"
|
|
|
|
then
|
|
|
|
oldcflags="-O3"
|
|
|
|
CFLAGS="-march=native"
|
|
|
|
AC_MSG_CHECKING([whether CC supports -march=native])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
|
|
|
[AC_MSG_RESULT([yes])]
|
|
|
|
[oldcflags="$oldcflags -march=native"],
|
|
|
|
[AC_MSG_RESULT([no])]
|
|
|
|
)
|
|
|
|
CFLAGS="-fomit-frame-pointer"
|
|
|
|
AC_MSG_CHECKING([whether CC supports -fomit-frame-pointer])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
|
|
|
[AC_MSG_RESULT([yes])]
|
|
|
|
[oldcflags="$oldcflags -fomit-frame-pointer"],
|
|
|
|
[AC_MSG_RESULT([no])]
|
|
|
|
)
|
|
|
|
CFLAGS="$oldcflags"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cstd=""
|
|
|
|
oldcflags="$CFLAGS"
|
|
|
|
CFLAGS="-std=c99"
|
|
|
|
AC_MSG_CHECKING([whether CC supports -std=c99])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
|
|
|
[AC_MSG_RESULT([yes])]
|
|
|
|
[cstd="-std=c99"],
|
|
|
|
[AC_MSG_RESULT([no])]
|
|
|
|
)
|
|
|
|
CFLAGS="$oldcflags"
|
|
|
|
|
|
|
|
nopie=""
|
2017-10-06 16:09:08 +02:00
|
|
|
|
2017-10-06 02:59:19 +02:00
|
|
|
oldcflags="$CFLAGS"
|
2017-10-06 16:09:08 +02:00
|
|
|
CFLAGS="-nopie"
|
|
|
|
AC_MSG_CHECKING([whether CC supports -nopie])
|
2017-10-06 02:59:19 +02:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
|
|
|
[AC_MSG_RESULT([yes])]
|
2017-10-06 16:09:08 +02:00
|
|
|
[nopie="-nopie"],
|
2017-10-06 02:59:19 +02:00
|
|
|
[AC_MSG_RESULT([no])]
|
|
|
|
)
|
|
|
|
CFLAGS="$oldcflags"
|
|
|
|
|
2017-10-06 16:09:08 +02:00
|
|
|
if test "x$nopie" = "x"
|
|
|
|
then
|
|
|
|
oldcflags="$CFLAGS"
|
|
|
|
CFLAGS="-no-pie"
|
|
|
|
AC_MSG_CHECKING([whether CC supports -no-pie])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
|
|
|
[AC_MSG_RESULT([yes])]
|
|
|
|
[nopie="-no-pie"],
|
|
|
|
[AC_MSG_RESULT([no])]
|
|
|
|
)
|
|
|
|
CFLAGS="$oldcflags"
|
|
|
|
fi
|
|
|
|
|
2017-10-02 16:11:23 +02:00
|
|
|
MYDEFS=""
|
|
|
|
|
2017-09-27 03:07:41 +02:00
|
|
|
ed25519impl=""
|
|
|
|
AC_ARG_ENABLE([ref10],
|
|
|
|
[AS_HELP_STRING([--enable-ref10],
|
2017-10-02 16:11:23 +02:00
|
|
|
[use SUPERCOP ref10 ed25519 implementation @<:@default=yes@:>@])],
|
2017-09-27 03:07:41 +02:00
|
|
|
[
|
|
|
|
AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "ref10"],
|
2017-09-27 20:07:33 +02:00
|
|
|
[AC_ERROR([only one ed25519 implementation can be defined])])
|
2017-09-27 03:07:41 +02:00
|
|
|
ed25519impl="ref10"
|
|
|
|
],
|
|
|
|
[]
|
|
|
|
)
|
|
|
|
|
2017-10-02 16:11:23 +02:00
|
|
|
AC_ARG_ENABLE([amd64-51-30k],
|
|
|
|
[AS_HELP_STRING([--enable-amd64-51-30k],
|
|
|
|
[use SUPERCOP amd64-51-30k ed25519 implementation @<:@default=no@:>@])],
|
2017-09-27 03:07:41 +02:00
|
|
|
[
|
|
|
|
AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "amd64_51_30k"],
|
2017-09-27 20:07:33 +02:00
|
|
|
[AC_ERROR([only one ed25519 implementation can be defined])])
|
2017-09-27 03:07:41 +02:00
|
|
|
ed25519impl="amd64_51_30k"
|
|
|
|
],
|
|
|
|
[]
|
|
|
|
)
|
|
|
|
|
2017-10-02 16:11:23 +02:00
|
|
|
AC_ARG_ENABLE([amd64-64-24k],
|
|
|
|
[AS_HELP_STRING([--enable-amd64-64-24k],
|
|
|
|
[use SUPERCOP amd64-64-24k ed25519 implementation @<:@default=no@:>@])],
|
2017-09-27 03:07:41 +02:00
|
|
|
[
|
|
|
|
AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "amd64_64_24k"],
|
2017-09-27 20:07:33 +02:00
|
|
|
[AC_ERROR([only one ed25519 implementation can be defined])])
|
2017-09-27 03:07:41 +02:00
|
|
|
ed25519impl="amd64_64_24k"
|
|
|
|
],
|
|
|
|
[]
|
|
|
|
)
|
|
|
|
|
2017-10-02 16:11:23 +02:00
|
|
|
AC_ARG_ENABLE([donna],
|
|
|
|
[AS_HELP_STRING([--enable-donna],
|
|
|
|
[use ed25519-donna implementation @<:@default=no@:>@])],
|
|
|
|
[
|
|
|
|
AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "donna"],
|
|
|
|
[AC_ERROR([only one ed25519 implementation can be defined])])
|
|
|
|
ed25519impl="donna"
|
|
|
|
],
|
|
|
|
[]
|
|
|
|
)
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([donna-sse2],
|
|
|
|
[AS_HELP_STRING([--enable-donna-sse2],
|
|
|
|
[use ed25519-donna SSE2 implementation @<:@default=no@:>@])],
|
|
|
|
[
|
|
|
|
AS_IF([test "x$ed25519impl" != "x" -a "$ed25519impl" != "donna-sse2"],
|
|
|
|
[AC_ERROR([only one ed25519 implementation can be defined])])
|
|
|
|
ed25519impl="donna-sse2"
|
|
|
|
],
|
|
|
|
[]
|
|
|
|
)
|
|
|
|
|
2017-09-27 03:07:41 +02:00
|
|
|
AS_IF([test "x$ed25519impl" == "x"],[ed25519impl=ref10])
|
|
|
|
|
2017-10-02 16:11:23 +02:00
|
|
|
if test "$ed25519impl" = "donna-sse2"
|
|
|
|
then
|
|
|
|
ed25519impl="donna"
|
|
|
|
MYDEFS="$MYDEFS -DED25519_SSE2"
|
|
|
|
CFLAGS="$CFLAGS -msse2"
|
|
|
|
fi
|
2017-09-30 05:40:12 +02:00
|
|
|
|
2017-10-08 23:15:08 +02:00
|
|
|
|
2017-09-27 20:07:33 +02:00
|
|
|
AC_ARG_ENABLE([intfilter],
|
|
|
|
[AS_HELP_STRING([--enable-intfilter],
|
2017-10-08 23:15:08 +02:00
|
|
|
[use 64-bit integers for filtering. faster but limits filter length to 12 @<:@default=no@:>@])],
|
2017-09-27 20:07:33 +02:00
|
|
|
[], [enable_intfilter=no]
|
|
|
|
)
|
2017-10-08 23:15:08 +02:00
|
|
|
AC_ARG_ENABLE([intfilter32],
|
|
|
|
[AS_HELP_STRING([--enable-intfilter32],
|
|
|
|
[use 32-bit integers for filtering. even faster on 32-bit machines but limits filter length to 6 @<:@default=no@:>@])],
|
|
|
|
[], [enable_intfilter32=no]
|
|
|
|
)
|
|
|
|
if test "x$enable_intfilter32" = "xyes"
|
2017-09-27 20:07:33 +02:00
|
|
|
then
|
2017-10-08 23:15:08 +02:00
|
|
|
if test "x$enable_intfilter" = "xyes"
|
|
|
|
then
|
|
|
|
AC_MSG_WARN([both intfilter and intfilter32 specified; using intfilter32])
|
|
|
|
fi
|
|
|
|
MYDEFS="$MYDEFS -DINTFILTER -DIFT=u32"
|
|
|
|
else
|
|
|
|
if test "x$enable_intfilter" = "xyes"
|
|
|
|
then
|
|
|
|
MYDEFS="$MYDEFS -DINTFILTER"
|
|
|
|
fi
|
2017-09-30 05:40:12 +02:00
|
|
|
fi
|
|
|
|
|
2017-10-10 03:02:43 +02:00
|
|
|
AC_ARG_ENABLE([binfilterlen],
|
|
|
|
[AS_HELP_STRING([--enable-binfilterlen=VAL],
|
|
|
|
[set binary string filter length (if you don't use intfilter) @<:@default=32@:>@])],
|
|
|
|
[], [enable_binfilterlen=no]
|
|
|
|
)
|
|
|
|
if test "x$enable_binfilterlen" != "xyes" -a "x$enable_binfilterlen" != "xno"
|
|
|
|
then
|
|
|
|
MYDEFS="$MYDEFS -DBINFILTERLEN=$enable_binfilterlen"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([binsearch],
|
|
|
|
[AS_HELP_STRING([--enable-binsearch],
|
|
|
|
[enable binary search algoritm; MUCH faster if there are a lot of filters @<:@default=no@:>@])],
|
|
|
|
[], [enable_binsearch=no]
|
|
|
|
)
|
|
|
|
if test "x$enable_binsearch" = "xyes"
|
|
|
|
then
|
|
|
|
MYDEFS="$MYDEFS -DBINSEARCH"
|
|
|
|
fi
|
|
|
|
|
2017-09-30 05:40:12 +02:00
|
|
|
AC_ARG_ENABLE([statistics],
|
|
|
|
[AS_HELP_STRING([--enable-statistics],
|
|
|
|
[collect statistics @<:@default=yes@:>@])],
|
|
|
|
[], [enable_statistics=yes]
|
|
|
|
)
|
|
|
|
if test "x$enable_statistics" = "xyes"
|
|
|
|
then
|
|
|
|
MYDEFS="$MYDEFS -DSTATISTICS"
|
2017-09-27 20:07:33 +02:00
|
|
|
fi
|
|
|
|
|
2017-10-06 02:59:19 +02:00
|
|
|
AC_SUBST(CSTD,["$cstd"])
|
2017-09-27 03:07:41 +02:00
|
|
|
AC_SUBST(ED25519IMPL,["$ed25519impl"])
|
2017-09-30 05:40:12 +02:00
|
|
|
AC_SUBST(MYDEFS,["$MYDEFS"])
|
2017-10-06 02:59:19 +02:00
|
|
|
AC_SUBST(NOPIE,["$nopie"])
|
2017-09-27 01:35:56 +02:00
|
|
|
AC_OUTPUT(Makefile)
|