build: Conditional enabling of osx-private-key-storage compilation
Makefile.am now contains a condition to enable/disable compilation of
osx-private-key-storage, instead of relying on define in the key storage
implementation.
Change-Id: I4a2079d99cd515c744cbe8f90a34a39e5c8197fa
diff --git a/Makefile.am b/Makefile.am
index 850d034..951e891 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -103,7 +103,6 @@
src/security/identity/identity-storage.cpp \
src/security/identity/memory-identity-storage.cpp \
src/security/identity/memory-private-key-storage.cpp \
- src/security/identity/osx-private-key-storage.cpp \
src/security/key-chain.cpp \
src/security/policy/no-verify-policy-manager.cpp \
src/security/policy/self-verify-policy-manager.cpp \
@@ -120,6 +119,12 @@
src/util/string-helper.hpp \
src/util/time.hpp
+if HAVE_OSX_SECURITY
+ libndn_cpp_la_SOURCES += src/security/identity/osx-private-key-storage.cpp
+else
+ EXTRA_DIST = src/security/identity/osx-private-key-storage.cpp
+endif
+
libndn_cpp_la_LIBADD = @OPENSSL_LIBS@ @CRYPTOPP_LIBS@ @OSX_SECURITY_LIBS@
libndn_cpp_la_LDFLAGS = @OPENSSL_LDFLAGS@ @CRYPTOPP_LDFLAGS@ @SQLITE3_LDFLAGS@ @BOOST_LDFLAGS@
libndn_cpp_la_CFLAGS = @OPENSSL_INCLUDES@ @CRYPTOPP_INCLUDES@ @SQLITE3_CFLAGS@ @BOOST_CPPFLAGS@
diff --git a/configure.ac b/configure.ac
index c668f29..5e19152 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,11 +114,13 @@
], [
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], 1, [1 if have the OSX framework.])
+ AM_CONDITIONAL(HAVE_OSX_SECURITY, true)
OSX_SECURITY_LIBS="-framework Security"
AC_SUBST([OSX_SECURITY_LIBS])
], [
AC_MSG_RESULT([no])
+ AM_CONDITIONAL(HAVE_OSX_SECURITY, false)
])
DX_HTML_FEATURE(ON)
diff --git a/src/security/identity/osx-private-key-storage.cpp b/src/security/identity/osx-private-key-storage.cpp
index 3f11c04..7989f06 100644
--- a/src/security/identity/osx-private-key-storage.cpp
+++ b/src/security/identity/osx-private-key-storage.cpp
@@ -5,9 +5,7 @@
* See COPYING for copyright and distribution information.
*/
-// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECURITY 1.
#include <ndn-cpp/ndn-cpp-config.h>
-#if NDN_CPP_HAVE_OSX_SECURITY
#include <fstream>
#include <sstream>
@@ -615,5 +613,3 @@
}
}
-
-#endif // NDN_CPP_HAVE_OSX_SECURITY