11PHP_ARG_WITH([ mongodb-sasl] ,
22 [ whether to enable SASL for Kerberos authentication] ,
3- [ AS_HELP_STRING ( [ --with-mongodb-sasl=@<:@ auto/no/cyrus/gssapi @:>@ ] ,
3+ [ AS_HELP_STRING ( [ --with-mongodb-sasl=@<:@ auto/no/cyrus@:>@ ] ,
44 [ MongoDB: Enable SASL for Kerberos authentication [ default=auto] ] ) ] ,
55 [ auto] ,
66 [ no] )
77
8- AS_IF ( [ test "$os_darwin" = "yes" -a \( "$PHP_MONGODB_SASL" = "gssapi" -o "$PHP_MONGODB_SASL" = "auto" \)] ,[
9- dnl PHP_FRAMEWORKS is only used for SAPI builds, so use MONGODB_SHARED_LIBADD for shared builds
10- if test "$ext_shared" = "yes"; then
11- MONGODB_SHARED_LIBADD="-framework GSS $MONGODB_SHARED_LIBADD"
12- else
13- PHP_ADD_FRAMEWORK([ GSS] )
14- fi
15- PHP_MONGODB_SASL="gssapi"
16- ] )
17-
188AS_IF ( [ test "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "auto"] ,[
199 found_cyrus="no"
2010
@@ -40,23 +30,16 @@ AS_IF([test "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "auto"],[
4030 fi
4131 ] )
4232
43- if test "$PHP_MONGODB_SASL" = "cyrus" -a "$found_cyrus" != "yes"; then
44- AC_MSG_ERROR ( [ Cyrus SASL libraries and development headers could not be found] )
33+ if test "$found_cyrus" = "yes"; then
34+ PHP_CHECK_LIBRARY([ sasl2] ,
35+ [ sasl_client_done] ,
36+ [ have_sasl_client_done=yes] ,
37+ [ have_sasl_client_done=no] ,
38+ $MONGODB_SHARED_LIBADD)
4539 fi
46- ] )
47-
48- AS_IF ( [ test "$PHP_MONGODB_SASL" = "gssapi" -o "$PHP_MONGODB_SASL" = "auto"] ,[
49- found_gssapi="no"
5040
51- PKG_CHECK_MODULES([ PHP_MONGODB_SASL] ,[ krb5-gssapi] ,[
52- PHP_MONGODB_MONGOC_CFLAGS="$PHP_MONGODB_MONGOC_CFLAGS $PHP_MONGODB_SASL_CFLAGS"
53- PHP_EVAL_LIBLINE([ $PHP_MONGODB_SASL_LIBS] ,[ MONGODB_SHARED_LIBADD] )
54- PHP_MONGODB_SASL="gssapi"
55- found_gssapi="yes"
56- ] )
57-
58- if test "$PHP_MONGODB_SASL" = "gssapi" -a "$found_gssapi" != "yes"; then
59- AC_MSG_ERROR ( [ GSSAPI libraries and development headers could not be found] )
41+ if test "$PHP_MONGODB_SASL" = "cyrus" -a "$found_cyrus" != "yes"; then
42+ AC_MSG_ERROR ( [ Cyrus SASL libraries and development headers could not be found] )
6043 fi
6144] )
6245
@@ -65,34 +48,27 @@ AS_IF([test "$PHP_MONGODB_SASL" = "auto"],[
6548] )
6649
6750dnl Warn for unsupported values (e.g. Cyrus SASL search path)
68- if test ! \( "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "gssapi" -o "$PHP_MONGODB_SASL" = " no" \); then
51+ if test ! \( "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "no" \); then
6952 AC_MSG_WARN ( [ unsupported --with-mongodb-sasl value: $PHP_MONGODB_SASL] )
7053fi
7154
7255AC_MSG_CHECKING ( [ which SASL library to use] )
7356AC_MSG_RESULT ( [ $PHP_MONGODB_SASL] )
7457
75- dnl Disable Windows SSPI
58+ dnl Disable Windows SSPI and GSSAPI
7659AC_SUBST ( MONGOC_ENABLE_SASL_SSPI , 0 )
60+ AC_SUBST ( MONGOC_ENABLE_SASL_GSSAPI , 0 )
7761
78- if test "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "gssapi" ; then
62+ if test "$PHP_MONGODB_SASL" = "cyrus"; then
7963 AC_SUBST ( MONGOC_ENABLE_SASL , 1 )
80- if test "$PHP_MONGODB_SASL" = "cyrus" ; then
81- AC_SUBST ( MONGOC_ENABLE_SASL_CYRUS , 1 )
82- AC_SUBST ( MONGOC_ENABLE_SASL_GSSAPI , 0 )
83- if test "x$have_sasl_client_done" = "xyes"; then
84- AC_SUBST ( MONGOC_HAVE_SASL_CLIENT_DONE , 1 )
85- else
86- AC_SUBST ( MONGOC_HAVE_SASL_CLIENT_DONE , 0 )
87- fi
88- elif test "$PHP_MONGODB_SASL" = "gssapi"; then
89- AC_SUBST ( MONGOC_ENABLE_SASL_CYRUS , 0 )
90- AC_SUBST ( MONGOC_ENABLE_SASL_GSSAPI , 1 )
64+ AC_SUBST ( MONGOC_ENABLE_SASL_CYRUS , 1 )
65+ if test "x$have_sasl_client_done" = "xyes"; then
66+ AC_SUBST ( MONGOC_HAVE_SASL_CLIENT_DONE , 1 )
67+ else
9168 AC_SUBST ( MONGOC_HAVE_SASL_CLIENT_DONE , 0 )
9269 fi
9370else
9471 AC_SUBST ( MONGOC_ENABLE_SASL , 0 )
9572 AC_SUBST ( MONGOC_ENABLE_SASL_CYRUS , 0 )
96- AC_SUBST ( MONGOC_ENABLE_SASL_GSSAPI , 0 )
9773 AC_SUBST ( MONGOC_HAVE_SASL_CLIENT_DONE , 0 )
9874fi
0 commit comments