# - incompatible interface change: c:r:a -> c+1:0:0
# - internal change: c:r:a -> c:r+1:a
-libd0_blind_id_la_SOURCES = d0_bignum-gmp.c d0_blind_id.c d0.c d0_iobuf.c sha2.c \
- d0_bignum-gmp.h d0_blind_id.h d0.h d0_iobuf.h sha2.h
+libd0_blind_id_la_SOURCES = d0_blind_id.c d0.c d0_iobuf.c sha2.c \
+ d0_blind_id.h d0.h d0_iobuf.h sha2.h
+if WITH_OPENSSL
+libd0_blind_id_la_SOURCES += d0_bignum-openssl.c d0_bignum-openssl.h
+else
+libd0_blind_id_la_SOURCES += d0_bignum-gmp.c d0_bignum-gmp.h
+endif
libd0_blind_id_la_LDFLAGS = -versioninfo 3:0:3
libd0_blind_id_la_CFLAGS = -fvisibility=hidden -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement
library_includedir = $(includedir)/d0_blind_id
AC_PROG_CC
AC_PROG_LIBTOOL
-AC_SEARCH_LIBS(__gmpz_init, gmp, , [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
+AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl], [Use OpenSSL instead of GMP (beware of the OpenSSL license)]), [enable_openssl=$enableval], [enable_openssl=no])
+AM_CONDITIONAL(ENABLE_OPENSSL, [test x$enable_openssl = xyes])
+
+if test x$enable_openssl = xyes
+then
+ AC_SEARCH_LIBS(BN_init, ssl, , [AC_MSG_ERROR([OpenSSL not found, see http://www.openssl.org/, or try --without-openssl])])
+else
+ AC_SEARCH_LIBS(__gmpz_init, gmp, , [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/, or try --with-openssl])])
+fi
AC_ARG_ENABLE(rijndael, AS_HELP_STRING([--disable-rijndael], [Disable build of the d0_rijndael library]), [enable_aes=$enableval], [enable_aes=yes])
AM_CONDITIONAL(ENABLE_RIJNDAEL, [test x$enable_aes = xyes])