build: Disable modification of global LIBS variable and explicitly specify library's CFLAGS, LDFLAGS, and LIBS variables
Change-Id: Iaf7dbffa993bb03c32cf76619ac684d7f0acd044
diff --git a/Makefile.am b/Makefile.am
index f191f26..d14b0b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,6 +68,10 @@
src/c/util/time.c \
src/c/util/time.h
+libndn_c_la_LIBADD = @OPENSSL_LIBS@
+libndn_c_la_LDFLAGS = @OPENSSL_LDFLAGS@
+libndn_c_la_CFLAGS = @OPENSSL_INCLUDES@
+
# C++ code and also the C code.
## To regenerate:
## for i in `find src -name '*.cpp' -or -name '*.hpp' -or -name '*.h' -and -not -path 'src/c/*'`; do echo " $i \\"; done
@@ -135,4 +139,8 @@
src/util/logging.cpp \
src/util/logging.hpp
+libndn_cpp_la_LIBADD = @OPENSSL_LIBS@ @OSX_SECURITY_LIBS@
+libndn_cpp_la_LDFLAGS = @OPENSSL_LDFLAGS@ @SQLITE3_LDFLAGS@ @BOOST_LDFLAGS@
+libndn_cpp_la_CFLAGS = @OPENSSL_INCLUDES@ @SQLITE3_CFLAGS@ @BOOST_CPPFLAGS@
+
dist_noinst_SCRIPTS = autogen.sh
diff --git a/configure.ac b/configure.ac
index 91f535e..7e367d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,14 +92,13 @@
AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 0, [1 if have sys/time gmtime support including timegm.])
])
-# Require libcrypto.
-AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
- [AC_MSG_FAILURE([can't find openssl crypto lib])])
+# Require openssl (libcrypto).
+AX_CHECK_OPENSSL([], [AC_MSG_FAILURE([can't find openssl crypto lib])])
# Conditionally use libsqlite3. AX_LIB_SQLITE3 defines HAVE_SQLITE3 in confdefs.h .
AX_LIB_SQLITE3()
if grep -q "#define HAVE_SQLITE3" confdefs.h ; then
- AC_CHECK_LIB([sqlite3], [sqlite3_open], [],
+ AC_CHECK_LIB([sqlite3], [sqlite3_open], [ ], # space necessar to prevent updating LIBS
[AC_MSG_FAILURE([have sqlite2 headers but no libsqlite3])])
fi
@@ -112,15 +111,13 @@
[[void test() { SecKeychainRef x; }]])
], [
AC_MSG_RESULT([yes])
- HAVE_OSX_SECURITY=1
+ AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], 1, [1 if have the OSX framework.])
+
+ OSX_SECURITY_LIBS="-framework Security"
+ AC_SUBST([OSX_SECURITY_LIBS])
], [
AC_MSG_RESULT([no])
- HAVE_OSX_SECURITY=0
])
-AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], $HAVE_OSX_SECURITY, [1 if have the OSX framework.])
-if test "$HAVE_OSX_SECURITY" == "1" ; then
- LIBS="$LIBS -framework Security"
-fi
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)