Re: [spice-common 04/13] build-sys: Move smartcard check to m4 macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2014-12-03 at 18:15 +0100, Christophe Fergeau wrote:
> ---
>  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 @@`

I don't have strong opinions on moving these checks into macros (or the
following patches that extract additional macros), but 
- Do they really need to all be in their own files? From a readability
point of view, I think it's nicer to be able to browse all of these
macros at once rather than opening a separate file to inspect each one
- In general, it'd be nice if the  m4 macros had their arguments
documented in a comment at the top of the macro. Then you don't have to
read the whole implementation to find out how to use 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
> +    AM_CONDITIONAL([WITH_SMARTCARD], [test "x$have_smartcard" = "xyes"])
> +    AS_VAR_APPEND([$1_CFLAGS], [" $SMARTCARD_CFLAGS"])
> +    AS_VAR_APPEND([$1_LIBS], [" $SMARTCARD_LIBS"])
> +])
> +
> +


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]