summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2015-06-23 13:52:43 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2015-06-23 13:52:43 -0400
commitd97efd4fb2ade6c6e9b3a3c9ba0dc870b2a025db (patch)
tree167f61b89330a3b2322f7cf0d21f6cad0e678847
parent1669102a168b6afe683d9d6fdb2417899fafc121 (diff)
configure.ac: Check for OpenSSL and Ur/Web
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac22
2 files changed, 27 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 7d43e88..e257a97 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,14 +16,16 @@ ACLOCAL_AMFLAGS = -I m4
CPPFLAGS = \
-Wall \
- -D_FORTIFY_SOURCE=2
+ -D_FORTIFY_SOURCE=2 \
+ @OpenSSL_CFLAGS@
CXXFLAGS = \
-std=c++11 \
-ftrapv \
-fstack-protector-strong --param=ssp-buffer-size=4 \
-fPIE \
- -O2
+ -O2 \
+ @OpenSSL_CFLAGS@
CXXFLAGS += \
-Weverything \
@@ -44,7 +46,7 @@ liburweb_crypto_hash_openssl_la_DATA = \
src/hash.ur \
src/hashFFI.urs
-liburweb_crypto_hash_openssl_la_LIBADD = -lurweb
+liburweb_crypto_hash_openssl_la_LIBADD = @OpenSSL_LIBS@ -lurweb
liburweb_crypto_hash_openssl_la_LDFLAGS = -export-symbols-regex '^uw_HashFFI_'
liburweb_crypto_hash_openssl_ladir = $(datadir)/urweb/ur/crypto-hash-openssl
diff --git a/configure.ac b/configure.ac
index 033fb32..1cbdc73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,4 +21,26 @@ AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CXX([clang++])
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
+AC_CHECK_HEADERS([openssl/md5.h openssl/sha.h],
+ [],
+ [AC_MSG_FAILURE([OpenSSL headers are required])])
+PKG_CHECK_MODULES([OpenSSL], [openssl])
+
+AC_CHECK_HEADERS([urweb/urweb_cpp.h],
+ [],
+ [AC_MSG_FAILURE([Ur/Web headers are required])])
+save_LIBS=$LIBS
+LIBS="$LIBS -lurweb"
+AC_LINK_IFELSE([AC_LANG_CALL(
+ [int uw_init_client_data;
+ int uw_copy_client_data;
+ int uw_global_custom;
+ int uw_do_expunge;
+ int uw_post_expunge;
+ int uw_free_client_data;],
+ [uw_error])],
+ [],
+ [AC_MSG_FAILURE([could not link with -lurweb])])
+LIBS=$save_LIBS
+
AC_OUTPUT([Makefile])