macosx: locate the best newest SDK present on the computer.

With recent versions of XCode, PC/SC headers are hidden inside
the SDK folder inside XCode app, and the global path is not
guaranteed to be present. This allows to build easily from source
without depending on a specific XCode/OSX version.
This commit is contained in:
Martin Paljak 2014-10-25 20:01:38 +03:00
parent 8ed4db76c8
commit 1145bed320
1 changed files with 5 additions and 1 deletions

View File

@ -530,7 +530,11 @@ if test "${enable_pcsc}" = "yes"; then
if test -z "${PCSC_CFLAGS}"; then
case "${host}" in
*-*-darwin*)
PCSC_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers"
# Locate the latest SDK.
SDKS_PATH="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
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"
;;
*)
PCSC_CFLAGS="-I/usr/include/PCSC"