Imported from spice-gtk e3c455b86dba0f924165fe0dc51583f48aecc8fb. It is not used by spice-common, but both server and client can use it. --- m4/spice-deps.m4 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4 index cb2b4c0..3579db5 100644 --- a/m4/spice-deps.m4 +++ b/m4/spice-deps.m4 @@ -263,3 +263,56 @@ AS_IF([test "x$1" != x], [missing_gstreamer_elements="no"]) ]) ]) + +# SPICE_CHECK_SASL +# ---------------- +# Adds a --with-sasl switch to allow using SASL for authentication. +# Checks whether the required library is available. If it is present, +# it will return the flags to use in SASL_CFLAGS and SASL_LIBS variables, +# and it will define a HAVE_SASL preprocessor symbol. +# ---------------- +AC_DEFUN([SPICE_CHECK_SASL], [ + AC_ARG_WITH([sasl], + [AS_HELP_STRING([--with-sasl=@<:@yes/no/auto@:>@], + [use cyrus SASL for authentication @<:@default=auto@:>@])], + [], + [with_sasl="auto"]) + + SASL_CFLAGS= + SASL_LIBS= + enable_sasl=no + if test "x$with_sasl" != "xno"; then + if test "x$with_sasl" != "xyes" && test "x$with_sasl" != "xauto"; then + SASL_CFLAGS="-I$with_sasl" + SASL_LIBS="-L$with_sasl" + fi + old_cflags="$CFLAGS" + old_libs="$LIBS" + CFLAGS="$CFLAGS $SASL_CFLAGS" + LIBS="$LIBS $SASL_LIBS" + AC_CHECK_HEADER([sasl/sasl.h],[with_sasl=yes]) + if test "x$with_sasl" = "xyes" ; then + AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl2=yes],[with_sasl2=no]) + fi + if test "x$with_sasl2" = "xno" && test "x$with_sasl" = "xyes" ; then + AC_CHECK_LIB([sasl], [sasl_client_init],[with_sasl=yes],[with_sasl=no]) + fi + if test "x$with_sasl2" = "xyes"; then + SASL_LIBS="$SASL_LIBS -lsasl2" + elif test "x$with_sasl" = "xyes"; then + SASL_LIBS="$SASL_LIBS -lsasl" + elif test "x$with_sasl" != "xauto"; then + AC_MSG_ERROR([Missing required Cyrus SASL development package]) + fi + CFLAGS="$old_cflags" + LIBS="$old_libs" + if test "x$with_sasl2" = "xyes" || test "x$with_sasl" = "xyes" ; then + AC_DEFINE_UNQUOTED([HAVE_SASL], 1, + [whether Cyrus SASL is available for authentication]) + enable_sasl=yes + fi + fi + AM_CONDITIONAL([HAVE_SASL], [test "x$with_sasl2" = "xyes" || test "x$with_sasl" = "xyes"]) + AC_SUBST([SASL_CFLAGS]) + AC_SUBST([SASL_LIBS]) +]) -- 2.5.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel