From 8955614755b4f49974f779a5e9a7cb6a427cd9f2 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 7 Aug 2012 16:19:14 +0200 Subject: build: add --enable-smartcard=auto support Currently, when running configure with no arguments, smartcard support is enabled by default, and configure will fail if it cannot find libcacard. This commit adds a --enable-smartcard=auto mode to configure which will use automatically enable smartcard support if libcacard is available, but it will be silently disabled if libcacard is not available. Passing --enable-smartcard will fail if libcacard is not available. Passing --disable-smartcard will always disable smartcard support and will not test for libcacard availability. --- configure.ac | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index e246f16..38ceeab 100644 --- a/configure.ac +++ b/configure.ac @@ -321,17 +321,21 @@ AC_SUBST(Z_LIBS) AC_ARG_ENABLE([smartcard], AS_HELP_STRING([--enable-smartcard=@<:@yes/no@:>@], - [Enable smartcard support @<:@default=yes@:>@]), + [Enable smartcard support @<:@default=auto@:>@]), [], - [enable_smartcard="yes"]) + [enable_smartcard="auto"]) -if test "x$enable_smartcard" = "xno"; then - AM_CONDITIONAL(WITH_SMARTCARD, false) -else - PKG_CHECK_MODULES(SMARTCARD, libcacard >= 0.1.2) - AC_DEFINE(USE_SMARTCARD, [1], [Define if supporting smartcard proxying]) - AM_CONDITIONAL(WITH_SMARTCARD, true) +have_smartcard=no +if test "x$enable_smartcard" != "xno"; then + PKG_CHECK_MODULES(SMARTCARD, libcacard >= 0.1.2, [have_smartcard=yes], [have_smartcard=no]) + if test "x$enable_smartcard" != "xauto" && test "x$have_smartcard" = "xno"; then + AC_MSG_ERROR("Smartcard support requested but libcacard could not be found") + fi + if test "x$have_smartcard" = "xyes"; then + AC_DEFINE(USE_SMARTCARD, [1], [Define if supporting smartcard proxying]) + fi fi +AM_CONDITIONAL([WITH_SMARTCARD], [test "x$have_smartcard" = "xyes"]) AC_ARG_ENABLE([usbredir], AS_HELP_STRING([--enable-usbredir=@<:@auto/yes/no@:>@], @@ -656,7 +660,7 @@ AC_MSG_NOTICE([ Audio: ${with_audio} Target: ${red_target} SASL support: ${enable_sasl} - Smartcard support: ${enable_smartcard} + Smartcard support: ${have_smartcard} USB redirection support: ${have_usbredir} Gtk: $GTK_API_VERSION -- cgit v1.2.3