From 2b69dc715287c4c3a161866705fc02433d4fd4ac Mon Sep 17 00:00:00 2001 From: Michael Farrell Date: Sun, 22 Sep 2019 21:15:21 +1000 Subject: [PATCH] Fix macOS compile and install issue --- pcsc-relay/configure.ac | 2 +- virtualsmartcard/configure.ac | 48 ++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/pcsc-relay/configure.ac b/pcsc-relay/configure.ac index c8dbf49..9475c15 100644 --- a/pcsc-relay/configure.ac +++ b/pcsc-relay/configure.ac @@ -74,7 +74,7 @@ PKG_CHECK_EXISTS([libpcsclite], SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -t. -k2 -r | head -1)}" # and set the PC/SC include path PCSC_CFLAGS="-I$SDK_PATH/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers -DRESPONSECODE_DEFINED_IN_WINTYPES_H -I`pwd`/${top_srcdir}/MacOSX" - PCSC_LIBS="--framework PCSC" + PCSC_LIBS="-framework PCSC" esac ]) diff --git a/virtualsmartcard/configure.ac b/virtualsmartcard/configure.ac index 24281ad..2cb6b70 100644 --- a/virtualsmartcard/configure.ac +++ b/virtualsmartcard/configure.ac @@ -100,7 +100,17 @@ if test "${libpcsclite}" = no ; then serialdropdir="`$PKG_CONFIG libpcsclite --variable=usbdropdir`/serial" if test "${serialdropdir}" = "/serial" ; then case "$host" in - *-*-darwin*) serialdropdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS; infoplist=yes ;; + *-*-darwin*) + MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 * 1000 + $2}') + if test "$MAC_VERSION" -ge "10011"; then + # System Integrity Protection means we can't write + # to /usr/libexec; even as root! + serialdropdir=/usr/local/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS + else + serialdropdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS + fi + infoplist=yes + ;; *) AC_MSG_ERROR([use --enable-serialdropdir=DIR]) esac fi @@ -108,7 +118,17 @@ if test "${libpcsclite}" = no ; then serialdropdir="${prefix}`$PKG_CONFIG libpcsclite --variable=usbdropdir`/serial" if test "${serialdropdir}" = "${prefix}/serial" ; then case "$host" in - *-*-darwin*) serialdropdir=${prefix}/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS; infoplist=yes ;; + *-*-darwin*) + MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 * 1000 + $2}') + if test "$MAC_VERSION" -ge "10011"; then + # System Integrity Protection means we can't write + # to /usr/libexec; even as root! + serialdropdir=${prefix}/usr/local/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS + else + serialdropdir=${prefix}/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS + fi + infoplist=yes + ;; *) AC_MSG_ERROR([use --enable-serialdropdir=DIR]) esac fi @@ -126,7 +146,17 @@ if test "${libpcsclite}" = no ; then serialconfdir="`$PKG_CONFIG libpcsclite --variable=serialconfdir`" if test "${serialconfdir}" = "" ; then case "$host" in - *-*-darwin*) serialconfdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents; infoplist=yes ;; + *-*-darwin*) + MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 * 1000 + $2}') + if test "$MAC_VERSION" -ge "10011"; then + # System Integrity Protection means we can't write + # to /usr/libexec; even as root! + serialconfdir=/usr/local/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents + else + serialconfdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents + fi + infoplist=yes + ;; *) serialconfdir="/etc/reader.conf.d" esac fi @@ -134,7 +164,17 @@ if test "${libpcsclite}" = no ; then serialconfdir="${prefix}`$PKG_CONFIG libpcsclite --variable=serialconfdir`" if test "${serialconfdir}" = "${prefix}" ; then case "$host" in - *-*-darwin*) serialconfdir=${prefix}/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents; infoplist=yes ;; + *-*-darwin*) + MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 * 1000 + $2}') + if test "$MAC_VERSION" -ge "10011"; then + # System Integrity Protection means we can't write + # to /usr/libexec; even as root! + serialconfdir=${prefix}/usr/local/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents + else + serialconfdir=${prefix}/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents + fi + infoplist=yes + ;; *) serialconfdir="${prefix}/etc/reader.conf.d" esac fi