make: Conditionally link to the OSX Security framework.
diff --git a/config.h.in b/config.h.in
index 4c049d2..7a832cd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -33,8 +33,8 @@
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
-/* 1 if have OSX SecKeychain. */
-#undef HAVE_OSX_SECKEYCHAIN
+/* 1 if have the OSX framework. */
+#undef HAVE_OSX_SECURITY
/* Have the SQLITE3 library */
#undef HAVE_SQLITE3
diff --git a/configure b/configure
index c179520..558e455 100755
--- a/configure
+++ b/configure
@@ -16683,7 +16683,7 @@
fi
if grep -q "#define HAVE_SQLITE3" confdefs.h ; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5
$as_echo_n "checking for sqlite3_open in -lsqlite3... " >&6; }
if ${ac_cv_lib_sqlite3_sqlite3_open+:} false; then :
$as_echo_n "(cached) " >&6
@@ -16735,8 +16735,9 @@
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSX SecKeychain" >&5
-$as_echo_n "checking for OSX SecKeychain... " >&6; }
+# Conditionally use the OSX Security framework .
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSX Security framework" >&5
+$as_echo_n "checking for OSX Security framework... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
@@ -16756,21 +16757,24 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- HAVE_OSX_SECKEYCHAIN=1
+ HAVE_OSX_SECURITY=1
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- HAVE_OSX_SECKEYCHAIN=0
+ HAVE_OSX_SECURITY=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat >>confdefs.h <<_ACEOF
-#define HAVE_OSX_SECKEYCHAIN $HAVE_OSX_SECKEYCHAIN
+#define HAVE_OSX_SECURITY $HAVE_OSX_SECURITY
_ACEOF
+if test "$HAVE_OSX_SECURITY" == "1" ; then
+ LIBS="$LIBS -framework Security"
+fi
diff --git a/configure.ac b/configure.ac
index f352260..078c51c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,11 +96,12 @@
# 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_MSG_FAILURE([have sqlite2 headers but no libsqlite3])])
+ AC_CHECK_LIB([sqlite3], [sqlite3_open], [],
+ [AC_MSG_FAILURE([have sqlite2 headers but no libsqlite3])])
fi
-AC_MSG_CHECKING([for OSX SecKeychain])
+# Conditionally use the OSX Security framework .
+AC_MSG_CHECKING([for OSX Security framework])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <CoreFoundation/CoreFoundation.h>]]
[[#include <Security/Security.h>]]
@@ -108,12 +109,15 @@
[[void test() { SecKeychainRef x; }]])
], [
AC_MSG_RESULT([yes])
- HAVE_OSX_SECKEYCHAIN=1
+ HAVE_OSX_SECURITY=1
], [
AC_MSG_RESULT([no])
- HAVE_OSX_SECKEYCHAIN=0
+ HAVE_OSX_SECURITY=0
])
-AC_DEFINE_UNQUOTED([HAVE_OSX_SECKEYCHAIN], $HAVE_OSX_SECKEYCHAIN, [1 if have OSX SecKeychain.])
+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)
diff --git a/ndn-cpp/security/identity/osx-private-key-storage.cpp b/ndn-cpp/security/identity/osx-private-key-storage.cpp
index d1ea2c5..2a58d85 100644
--- a/ndn-cpp/security/identity/osx-private-key-storage.cpp
+++ b/ndn-cpp/security/identity/osx-private-key-storage.cpp
@@ -5,10 +5,9 @@
* See COPYING for copyright and distribution information.
*/
-// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECKEYCHAIN 1.
+// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECURITY 1.
#include "../../ndn-cpp-config.h"
-#if 0 // temporarily disable.
-//#if NDN_CPP_HAVE_OSX_SECKEYCHAIN
+#if NDN_CPP_HAVE_OSX_SECURITY
#include <fstream>
#include <sstream>
@@ -513,4 +512,4 @@
}
-#endif NDN_CPP_HAVE_OSX_SECKEYCHAIN
+#endif NDN_CPP_HAVE_OSX_SECURITY
diff --git a/ndn-cpp/security/identity/osx-private-key-storage.hpp b/ndn-cpp/security/identity/osx-private-key-storage.hpp
index 514d660..d206a04 100644
--- a/ndn-cpp/security/identity/osx-private-key-storage.hpp
+++ b/ndn-cpp/security/identity/osx-private-key-storage.hpp
@@ -8,10 +8,9 @@
#ifndef NDN_OSX_PRIVATEKEY_STORAGE_H
#define NDN_OSX_PRIVATEKEY_STORAGE_H
-// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECKEYCHAIN 1.
+// Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_OSX_SECURITY 1.
#include "../../ndn-cpp-config.h"
-#if 0 // temporarily disable.
-//#if NDN_CPP_HAVE_OSX_SECKEYCHAIN
+#if NDN_CPP_HAVE_OSX_SECURITY
#include "../../common.hpp"
#include "private-key-storage.hpp"
@@ -201,6 +200,6 @@
}
-#endif NDN_CPP_HAVE_OSX_SECKEYCHAIN
+#endif NDN_CPP_HAVE_OSX_SECURITY
#endif