Browse Source

Use PKG_CHECK_MODULES to detect the libsasl2 library

Hugh McMaster 6 years ago
parent
commit
e50466ee16
3 changed files with 8 additions and 115 deletions
  1. 4 8
      Makefile.am
  2. 4 12
      configure.ac
  3. 0 95
      m4/sasl.m4

+ 4 - 8
Makefile.am

@@ -31,8 +31,6 @@ CMOCKA_INCLUDES = $(CMOCKA_CFLAGS)
 PROFILING_DEFINES = @profiling_defs@
 NSPR_INCLUDES = $(NSPR_CFLAGS)
 
-SASL_INCLUDES = @sasl_inc@
-
 # Rust inclusions.
 if RUST_ENABLE
 RUST_ON = 1
@@ -170,7 +168,7 @@ ldaplib = @ldaplib@
 ldaplib_defs = @ldaplib_defs@
 
 DB_LINK = @db_lib@ -ldb-@db_libver@
-SASL_LINK = @sasl_lib@ -lsasl2
+SASL_LINK = $(SASL_LIBS)
 NETSNMP_LINK = @netsnmp_lib@ @netsnmp_link@
 PAM_LINK = -lpam
 KERBEROS_LINK = $(kerberos_lib)
@@ -1386,7 +1384,7 @@ libslapd_la_SOURCES = ldap/servers/slapd/add.c \
 	ldap/servers/slapd/slapi_pal.c \
 	$(libavl_a_SOURCES)
 
-libslapd_la_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES) @db_inc@ @kerberos_inc@ $(PCRE_CFLAGS) $(SDS_CPPFLAGS) $(SVRCORE_INCLUDES)
+libslapd_la_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_CFLAGS) @db_inc@ @kerberos_inc@ $(PCRE_CFLAGS) $(SDS_CPPFLAGS) $(SVRCORE_INCLUDES)
 libslapd_la_LIBADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) $(NSPR_LINK) $(KERBEROS_LINK) $(PCRE_LIBS) $(THREADLIB) $(SYSTEMD_LINK) libsds.la libsvrcore.la
 libslapd_la_LDFLAGS = $(AM_LDFLAGS) $(SLAPD_LDFLAGS)
 
@@ -2012,7 +2010,7 @@ ldclt_SOURCES = ldap/servers/slapd/tools/ldaptool-sasl.c \
 	ldap/servers/slapd/tools/ldclt/version.c \
 	ldap/servers/slapd/tools/ldclt/workarounds.c
 
-ldclt_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/ldap/servers/slapd/tools $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES)
+ldclt_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/ldap/servers/slapd/tools $(DSPLUGIN_CPPFLAGS) $(SASL_CFLAGS)
 ldclt_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET) $(LIBDL) $(THREADLIB)
 
 #------------------------
@@ -2089,7 +2087,7 @@ ns_slapd_SOURCES = ldap/servers/slapd/abandon.c \
 	ldap/servers/slapd/unbind.c \
 	$(GETSOCKETPEER)
 
-ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES) $(SVRCORE_INCLUDES)
+ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_CFLAGS) $(SVRCORE_INCLUDES)
 ns_slapd_LDADD = libnunc-stans.la libslapd.la libldaputil.la libsvrcore.la $(LDAPSDK_LINK) $(NSS_LINK) $(LIBADD_DL) \
 	$(NSPR_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET) $(THREADLIB) $(SYSTEMD_LINK) $(EVENT_LINK)
 ns_slapd_DEPENDENCIES = libslapd.la libnunc-stans.la libldaputil.la
@@ -2228,8 +2226,6 @@ fixupcmd = sed \
 	-e 's,@plainldif_opts\@,$(plainldif_opts),g' \
 	-e 's,@db_libdir\@,$(db_libdir),g' \
 	-e 's,@db_bindir\@,$(db_bindir),g' \
-	-e 's,@sasl_libdir\@,$(sasl_libdir),g' \
-	-e 's,@sasl_path\@,@sasl_path@,g' \
 	-e 's,@netsnmp_libdir\@,$(netsnmp_libdir),g' \
 	-e 's,@pcre_libdir\@,$(pcre_libdir),g' \
 	-e 's,@propertydir\@,$(propertydir),g' \

+ 4 - 12
configure.ac

@@ -836,7 +836,10 @@ AC_SUBST(nss_libdir)
 m4_include(m4/openldap.m4)
 m4_include(m4/mozldap.m4)
 m4_include(m4/db.m4)
-m4_include(m4/sasl.m4)
+
+PKG_CHECK_MODULES([SASL], [libsasl2])
+# Workaround failure by Mozilla ldapsdk to #include <sasl/sasl.h>
+SASL_CFLAGS="$SASL_CFLAGS -I$includedir/sasl"
 
 PKG_CHECK_MODULES([ICU], [icu-i18n >= 60.2])
 
@@ -871,13 +874,6 @@ m4_include(m4/doxygen.m4)
 PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
 AC_SUBST(PACKAGE_BASE_VERSION)
 
-# set sasl_path for wrapper scripts
-if test -z "$sasl_libdir" ; then
-  sasl_path="$libdir/sasl2"
-else
-  sasl_path="$sasl_libdir/sasl2"
-fi
-
 AM_CONDITIONAL(OPENLDAP,test "$with_openldap" = "yes")
 
 # write out paths for binary components
@@ -890,10 +886,6 @@ AC_SUBST(ldaplib_defs)
 AC_SUBST(ldaptool_bindir)
 AC_SUBST(ldaptool_opts)
 AC_SUBST(plainldif_opts)
-AC_SUBST(sasl_inc)
-AC_SUBST(sasl_lib)
-AC_SUBST(sasl_libdir)
-AC_SUBST(sasl_path)
 AC_SUBST(nunc_stans_inc)
 AC_SUBST(nunc_stans_lib)
 AC_SUBST(nunc_stans_libdir)

+ 0 - 95
m4/sasl.m4

@@ -1,95 +0,0 @@
-# BEGIN COPYRIGHT BLOCK
-# Copyright (C) 2007 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details. 
-# END COPYRIGHT BLOCK
-# -*- tab-width: 4; -*-
-# Configure paths for SASL
-
-dnl ========================================================
-dnl = sasl is used to support various authentication mechanisms
-dnl = such as DIGEST-MD5 and GSSAPI.
-dnl ========================================================
-dnl ========================================================
-dnl = Use the sasl libraries on the system (assuming it exists)
-dnl ========================================================
-AC_CHECKING(for SASL)
-
-AC_MSG_CHECKING(for --with-sasl)
-AC_ARG_WITH(sasl,
-    AS_HELP_STRING([--with-sasl@<:@=PATH@:>@],[Use SASL from supplied path]),
-    dnl = Look in the standard system locations
-    [
-      if test "$withval" = "yes"; then
-        AC_MSG_RESULT(yes)
-
-      elif test "$withval" = "no"; then
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR([SASL is required.])
-
-      dnl = Check the user provided location
-      elif test -d "$withval" -a -d "$withval/lib" -a -d "$withval/include" ; then
-        AC_MSG_RESULT([using $withval])
-
-        if test -f "$withval/include/sasl/sasl.h"; then
-          sasl_inc="-I$withval/include/sasl"
-        elif test -f "$withval/include/sasl.h"; then
-          sasl_inc="-I$withval/include"
-        else
-          AC_MSG_ERROR(sasl.h not found)
-        fi
-
-        sasl_lib="-L$withval/lib"
-        sasl_libdir="$withval/lib"
-      else
-          AC_MSG_RESULT(yes)
-          AC_MSG_ERROR([SASL not found in $withval])
-      fi
-    ],
-    AC_MSG_RESULT(yes))
-
-AC_MSG_CHECKING(for --with-sasl-inc)
-AC_ARG_WITH(sasl-inc,
-    AS_HELP_STRING([--with-sasl-inc=PATH],[SASL include file directory]),
-    [
-      if test -f "$withval"/sasl.h; then
-        AC_MSG_RESULT([using $withval])
-        sasl_inc="-I$withval"
-      else
-        echo
-        AC_MSG_ERROR([$withval/sasl.h not found])
-      fi
-    ],
-    AC_MSG_RESULT(no))
-
-AC_MSG_CHECKING(for --with-sasl-lib)
-AC_ARG_WITH(sasl-lib,
-    AS_HELP_STRING([--with-sasl-lib=PATH],[SASL library directory]),
-    [
-      if test -d "$withval"; then
-        AC_MSG_RESULT([using $withval])
-        sasl_lib="-L$withval"
-        sasl_libdir="$withval"
-      else
-        echo
-        AC_MSG_ERROR([$withval not found])
-      fi
-    ],
-    AC_MSG_RESULT(no))
-
-if test -z "$sasl_inc"; then
-  AC_MSG_CHECKING(for sasl.h)
-  dnl - Check for sasl in standard system locations
-  if test -f /usr/include/sasl/sasl.h; then
-    AC_MSG_RESULT([using /usr/include/sasl/sasl.h])
-    sasl_inc="-I/usr/include/sasl"
-  elif test -f /usr/include/sasl.h; then
-    AC_MSG_RESULT([using /usr/include/sasl.h])
-    sasl_inc="-I/usr/include"
-  else
-    AC_MSG_RESULT(no)
-    AC_MSG_ERROR([SASL not found, specify with --with-sasl.])
-  fi
-fi