summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2013-02-27 15:51:51 +0100
committerNiels Möller <nisse@lysator.liu.se>2013-02-27 15:51:51 +0100
commitc8841e6900453c963db7ab64270de9fc81a21180 (patch)
treef0afbcd1873c374a385dd4c7b18c580bf7b4d600 /configure.ac
parentaf597e7cb0126c93364c48687087abc4dadcf538 (diff)
downloadnettle-c8841e6900453c963db7ab64270de9fc81a21180.tar.gz
Prepare autoconf and Makefile for optional assembly files.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac59
1 files changed, 50 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 848601d4..26776bb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -237,25 +237,50 @@ if test "x$enable_assembler" = xyes ; then
;;
esac
fi
-# echo "enable_assembler: $enable_assembler, asm_path: $asm_path"
+
+# Files which replace a C source file (or otherwise don't correspond
+# to a new object file).
+asm_replace_list="aes-encrypt-internal.asm aes-decrypt-internal.asm \
+ arcfour-crypt.asm camellia-crypt-internal.asm \
+ md5-compress.asm memxor.asm \
+ salsa20-crypt.asm salsa20-core-internal.asm \
+ serpent-encrypt.asm serpent-decrypt.asm \
+ sha1-compress.asm machine.m4"
+# Assembler files which generate additional object files if they are used.
+asm_optional_list=""
+
+if test "x$enable_public_key" = "xyes" ; then
+ asm_optional_list="$asm_search_list ecc-192-modp.asm ecc-256-redc.asm"
+fi
+
+OPT_ASM_SOURCES=""
+
asm_file_list=""
if test "x$enable_assembler" = xyes ; then
if test -n "$asm_path"; then
AC_MSG_NOTICE([Looking for assembler files in $asm_path/.])
- for tmp_f in aes-encrypt-internal.asm aes-decrypt-internal.asm \
- arcfour-crypt.asm camellia-crypt-internal.asm \
- md5-compress.asm memxor.asm \
- salsa20-crypt.asm salsa20-core-internal.asm \
- serpent-encrypt.asm serpent-decrypt.asm \
- sha1-compress.asm machine.m4; do
-# echo "Looking for $srcdir/$asm_path/$tmp_f"
+ for tmp_f in $asm_replace_list ; do
if test -f "$srcdir/$asm_path/$tmp_f"; then
-# echo found
asm_file_list="$asm_file_list $tmp_f"
AC_CONFIG_LINKS($tmp_f:$asm_path/$tmp_f)
fi
done
+ dnl Workaround for AC_CONFIG_LINKS, which complains if we use the
+ dnl same destination argument $tmp_f multiple times.
+ for tmp_o in $asm_optional_list ; do
+ if test -f "$srcdir/$asm_path/$tmp_o"; then
+ asm_file_list="$asm_file_list $tmp_o"
+ AC_CONFIG_LINKS($tmp_o:$asm_path/$tmp_o)
+ while read tmp_func ; do
+ AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func)
+ eval HAVE_NATIVE_$tmp_func=yes
+ done <<EOF
+[`sed -n 's/[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_path/$tmp_o"`]
+EOF
+ OPT_ASM_SOURCES="$OPT_SOURCES $tmp_o"
+ fi
+ done
if test -z "$asm_file_list"; then
enable_assembler=no
AC_MSG_WARN([No assembler files found.])
@@ -263,6 +288,22 @@ if test "x$enable_assembler" = xyes ; then
fi
fi
+AC_SUBST([OPT_ASM_SOURCES])
+
+AH_VERBATIM([HAVE_NATIVE],
+[/* Define to 1 each of the following for which a native (ie. CPU specific)
+ implementation of the corresponding routine exists. */
+#undef HAVE_NATIVE_ecc_192_modp
+#undef HAVE_NATIVE_ecc_192_redc
+#undef HAVE_NATIVE_ecc_224_modp
+#undef HAVE_NATIVE_ecc_224_redc
+#undef HAVE_NATIVE_ecc_256_modp
+#undef HAVE_NATIVE_ecc_256_redc
+#undef HAVE_NATIVE_ecc_384_modp
+#undef HAVE_NATIVE_ecc_384_redc
+#undef HAVE_NATIVE_ecc_521_modp
+#undef HAVE_NATIVE_ecc_521_redc])
+
# Besides getting correct dependencies, the explicit rules also tell
# make that the .s files "ought to exist", so they are preferred over
# .c files.