Index: src/Makefile.in
--- src/Makefile.in.orig	2010-11-26 07:00:32.000000000 +0100
+++ src/Makefile.in	2010-11-26 12:08:32.000000000 +0100
@@ -110,7 +110,7 @@
 AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
-CFLAGS = -I/usr/local/include -Wall -g -c
+CFLAGS = @CFLAGS@ @CPPFLAGS@ -c
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -128,7 +128,7 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = -L/usr/local/lib -lldap
+LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LTLIBOBJS = @LTLIBOBJS@
@@ -559,28 +559,28 @@
 all-debug: lacctparse_debug luseradd_debug
 
 lacctparse_debug: ${OBJS} lacctparse.o
-	${CC} ${DEBUG} ${LDFLAGS} ${OBJS} lacctparse.o -o lacctparse
+	${CC} ${DEBUG} ${LDFLAGS} ${OBJS} lacctparse.o -o lacctparse ${LIBS}
 
 lacctparse: ${OBJS} lacctparse.o
-	${CC} ${LDFLAGS} ${OBJS} lacctparse.o -o lacctparse
+	${CC} ${LDFLAGS} ${OBJS} lacctparse.o -o lacctparse ${LIBS}
 
 luseradd: ${OBJS} luseradd.o
-	${CC} ${LDFLAGS} ${OBJS} luseradd.o -o luseradd
+	${CC} ${LDFLAGS} ${OBJS} luseradd.o -o luseradd ${LIBS}
 
 lgroupadd: ${OBJS} lgroupadd.o
-	${CC} ${LDFLAGS} ${OBJS} lgroupadd.o -o lgroupadd
+	${CC} ${LDFLAGS} ${OBJS} lgroupadd.o -o lgroupadd ${LIBS}
 
 luserdel: ${OBJS} luserdel.o
-	${CC} ${LDFLAGS} ${OBJS} luserdel.o -o luserdel
+	${CC} ${LDFLAGS} ${OBJS} luserdel.o -o luserdel ${LIBS}
 
 lgroupdel: ${OBJS} lgroupdel.o
-	${CC} ${LDFLAGS} ${OBJS} lgroupdel.o -o lgroupdel
+	${CC} ${LDFLAGS} ${OBJS} lgroupdel.o -o lgroupdel ${LIBS}
 
 lusermod: ${OBJS} lusermod.o
-	${CC} ${LDFLAGS} ${OBJS} lusermod.o -o lusermod
+	${CC} ${LDFLAGS} ${OBJS} lusermod.o -o lusermod ${LIBS}
 
 lgroupmod: ${OBJS} lgroupmod.o
-	${CC} ${LDFLAGS} ${OBJS} lgroupmod.o -o lgroupmod
+	${CC} ${LDFLAGS} ${OBJS} lgroupmod.o -o lgroupmod ${LIBS}
 
 @SUDOON_TRUE@sudoldap.o: uxds.h  sudoldap.c
 @SUDOON_TRUE@	${CC} ${DEBUG} ${CFLAGS} sudoldap.c
@@ -601,10 +601,10 @@
 @SUDOON_TRUE@	${CC} ${LDFLAGS} ${SUOBJS} lsudodel.o -o lsudodel
 
 @SUDOON_TRUE@lsudomod: ${SUOBJS} lsudomod.o
-@SUDOON_TRUE@	${CC} ${LDFLAGS} ${SUOBJS} lsudomod.o -o lsudomod
+@SUDOON_TRUE@	${CC} ${LDFLAGS} ${SUOBJS} lsudomod.o -o lsudomod ${LIBS}
 
 luseradd_debug: ${OBJS} luseradd.o
-	${CC} ${DEBUG} ${LDFLAGS} ${OBJS} luseradd.o -o luseradd
+	${CC} ${DEBUG} ${LDFLAGS} ${OBJS} luseradd.o -o luseradd ${LIBS}
 
 strings.o: uxds.h uxds_strings.h strings.c
 	${CC} ${DEBUG} ${CFLAGS} strings.c
Index: src/args.c
--- src/args.c.orig	2010-11-26 06:59:22.000000000 +0100
+++ src/args.c	2010-11-26 12:08:32.000000000 +0100
@@ -560,8 +560,10 @@
 		int g = 7;
 		if (auth->debug)
 		    g++;
+#if defined(HAVE_LDAP_SASL) && defined(HAVE_LDAP_SASL_GSSAPI)
 		if (auth->pkcert)
 		    g = g + 2;
+#endif
 		if ((atype != GROUP) && (atype != SUDOER) && (op != ADD)) {
 		    if ((op == MOD) && (argc > g)) {
 			fprintf(stderr,
Index: src/ldap.c
--- src/ldap.c.orig	2010-11-26 06:59:22.000000000 +0100
+++ src/ldap.c	2010-11-26 12:08:54.000000000 +0100
@@ -521,7 +521,7 @@
 	addr = strdup(mbx);
     }
 #endif				/* QMAIL */
-#ifdef HAVE_LDAP_SASL_GSSAPI
+#if defined(HAVE_LDAP_SASL_GSSAPI) && defined(HDB_LDAP)
     char *principal = center(cbuf, mdata.user, AT_REALM);
 #endif				/* HAVE_LDAP_SASL_GSSAPI */
     /*
@@ -556,7 +556,9 @@
 	{USER, "mailAlternateAddress", addr},
 #endif				/* QMAIL */
 #ifdef HDB_LDAP
+#if defined(HAVE_LDAP_SASL_GSSAPI)
 	{USER, "krb5PrincipalName", principal},
+#endif
 	{USER, "krb5MaxLife", "86400"},
 	{USER, "krb5MaxRenew", "604800"},
 	{USER, "krb5KDCFlags", "126"},
Index: src/lusermod.c
--- src/lusermod.c.orig	2010-11-26 06:59:22.000000000 +0100
+++ src/lusermod.c	2010-11-26 12:08:32.000000000 +0100
@@ -32,7 +32,11 @@
     char *bin = argv[0];
     sflag = parse_args(argc, argv, USER, MOD, 6, &auth, &mdata, bin);
 
+#if defined(HAVE_LDAP_SASL) && defined(HAVE_LDAP_SASL_GSSAPI)
     if ((auth.pkcert) && (argc < 8)) {
+#else
+    if (argc < 8) {
+#endif
 	if ((!mdata.exp) || (!mdata.cpw)) {
 	    fprintf(stderr,
 		    "At least ONE attribute must be selected to use lusermod.\n");
Index: src/uxds.h
--- src/uxds.h.orig	2010-11-26 06:59:22.000000000 +0100
+++ src/uxds.h	2010-11-26 12:08:32.000000000 +0100
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>		/* struct timeval: OpenLDAP future use */
-#include <parse_time.h>
 #include <errno.h>		/* ENOMEM, etc. */
 #include <ctype.h>
 #include <err.h>
