[Spice-devel] [spice-common v2 07/11] build-sys: Move smartcard check to m4 macro

Jonathon Jongsma jjongsma at redhat.com
Tue Dec 9 07:23:48 PST 2014


On Tue, 2014-12-09 at 15:39 +0100, Christophe Fergeau wrote:
> ---
>  common/Makefile.am |  3 ++-
>  configure.ac       | 19 +++----------------
>  m4/spice-deps.m4   | 29 +++++++++++++++++++++++++++++
>  3 files changed, 34 insertions(+), 17 deletions(-)
> 
> diff --git a/common/Makefile.am b/common/Makefile.am
> index 2c82adc..cbb8f8b 100644
> --- a/common/Makefile.am
> +++ b/common/Makefile.am
> @@ -91,15 +91,16 @@ endif
>  
>  AM_CPPFLAGS =				\
>  	-I$(top_srcdir)			\
> +	$(SPICE_COMMON_CFLAGS)		\
>  	$(GL_CFLAGS)			\
>  	$(PIXMAN_CFLAGS)		\
>  	$(CELT051_CFLAGS)		\
>  	$(OPUS_CFLAGS)		        \
>  	$(PROTOCOL_CFLAGS)		\
> -	$(SMARTCARD_CFLAGS)		\
>  	$(NULL)
>  
>  libspice_common_la_LIBADD =				\
> +	$(SPICE_COMMON_LIBS)				\
>  	$(OPUS_LIBS)		                        \
>  	$(CELT051_LIBS)
>  
> diff --git a/configure.ac b/configure.ac
> index 67e485e..27893cc 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -39,22 +39,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
> +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/spice-deps.m4 b/m4/spice-deps.m4
> index 3dcc4b0..de9c573 100644
> --- a/m4/spice-deps.m4
> +++ b/m4/spice-deps.m4
> @@ -25,3 +25,32 @@ AC_DEFUN([SPICE_CHECK_SYSDEPS], [
>      AC_FUNC_FORK
>      AC_CHECK_FUNCS([dup2 floor inet_ntoa memmove memset pow sqrt])
>  ])
> +
> +
> +# SPICE_CHECK_SMARTCARD(PREFIX)
> +# -----------------------------
> +# Adds a --enable-smartcard switch in order to enable/disable smartcard
> +# support, and checks if the needed libraries are available. If found, it will
> +# set the $PREFIX_CFLAGS and $PREFIX_LIBS variables, and it will define a
> +# USE_SMARTCARD preprocessor symbol.


ACK to this series, although it would be more accurate here (and in the
other macro docs) to say that it *appends* to $PREFIX_CFLAGS/LIBS rather
than *sets* them.


> +#------------------------------
> +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
> +    AS_VAR_APPEND([$1_CFLAGS], [" $SMARTCARD_CFLAGS"])
> +    AS_VAR_APPEND([$1_LIBS], [" $SMARTCARD_LIBS"])
> +])




More information about the Spice-devel mailing list