[Spice-devel] [spice-common 04/13] build-sys: Move smartcard check to m4 macro
Christophe Fergeau
cfergeau at redhat.com
Wed Dec 3 09:15:19 PST 2014
---
common/Makefile.am | 3 ++-
configure.ac | 20 +++-----------------
m4/smartcard.m4 | 23 +++++++++++++++++++++++
3 files changed, 28 insertions(+), 18 deletions(-)
create mode 100644 m4/smartcard.m4
diff --git a/common/Makefile.am b/common/Makefile.am
index 7b3aae9..4b39f79 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -92,18 +92,19 @@ endif
AM_CPPFLAGS = \
-I$(top_srcdir) \
+ $(SPICE_COMMON_CFLAGS) \
$(GL_CFLAGS) \
$(PIXMAN_CFLAGS) \
$(CELT051_CFLAGS) \
$(OPUS_CFLAGS) \
$(PROTOCOL_CFLAGS) \
- $(SMARTCARD_CFLAGS) \
$(VISIBILITY_HIDDEN_CFLAGS) \
$(WARN_CFLAGS) \
-std=gnu99 \
$(NULL)
libspice_common_la_LIBADD = \
+ $(SPICE_COMMON_LIBS) \
$(OPUS_LIBS) \
$(CELT051_LIBS)
diff --git a/configure.ac b/configure.ac
index 477c8fe..145dac4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,23 +35,9 @@ AC_SUBST(PROTOCOL_CFLAGS)
PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
AC_SUBST(PIXMAN_CFLAGS)
-AC_ARG_ENABLE([smartcard],
- AS_HELP_STRING([--enable-smartcard=@<:@yes/no/auto@:>@],
- [Enable smartcard support @<:@default=auto@:>@]),
- [],
- [enable_smartcard="auto"])
-
-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"])
+SPICE_CHECK_SMARTCARD(SPICE_COMMON)
+AC_SUBST(SPICE_COMMON_CFLAGS)
+AC_SUBST(SPICE_COMMON_LIBS)
AC_ARG_ENABLE(celt051,
[ --disable-celt051 Disable celt051 audio codec (enabled by default)],,
diff --git a/m4/smartcard.m4 b/m4/smartcard.m4
new file mode 100644
index 0000000..e7ccca7
--- /dev/null
+++ b/m4/smartcard.m4
@@ -0,0 +1,23 @@
+AC_DEFUN([SPICE_CHECK_SMARTCARD], [
+ AC_ARG_ENABLE([smartcard],
+ AS_HELP_STRING([--enable-smartcard=@<:@yes/no/auto@:>@],
+ [Enable smartcard support @<:@default=auto@:>@]),
+ [],
+ [enable_smartcard="auto"])
+
+ 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"])
+ AS_VAR_APPEND([$1_CFLAGS], [" $SMARTCARD_CFLAGS"])
+ AS_VAR_APPEND([$1_LIBS], [" $SMARTCARD_LIBS"])
+])
+
+
--
2.1.0
More information about the Spice-devel
mailing list