Give path given in --with-xxx= for pcre,zlib, and
tcp-wrappers precedence over system libraries and includes.
Report from Dave Dykstra <dwd@bell-labs.com>
diff --git a/ChangeLog b/ChangeLog
index 3f6388b..c14f7d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 20011025
  - (bal) Use VDISABLE if _POSIX_VDISABLE is set in readpassphrase.c.  Patch
    by todd@
+ - (tim) [configure.ac] Give path given in --with-xxx= for pcre,zlib, and
+	 tcp-wrappers precedence over system libraries and includes.
+	 Report from Dave Dykstra <dwd@bell-labs.com>
 
 20011024
  - (bal) Should be 3.0p1 not 3.0p2.  Corrected version.h already.
@@ -6760,4 +6763,4 @@
  - Wrote replacements for strlcpy and mkdtemp
  - Released 1.0pre1
 
-$Id: ChangeLog,v 1.1617 2001/10/25 15:02:35 mouring Exp $
+$Id: ChangeLog,v 1.1618 2001/10/25 17:01:30 tim Exp $
diff --git a/configure.ac b/configure.ac
index 185ed30..10cca44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.1 2001/10/25 04:15:26 tim Exp $
+# $Id: configure.ac,v 1.2 2001/10/25 17:01:31 tim Exp $
 
 AC_INIT
 AC_CONFIG_SRCDIR([ssh.c])
@@ -324,21 +324,21 @@
 			if test "x$withval" != "xyes"; then
 				if test -d "$withval/lib"; then
 					if test -n "${need_dash_r}"; then
-						LDFLAGS="${LDFLAGS} -L$withval/lib -R$withval/lib"
+						LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
 					else
-						LDFLAGS="${LDFLAGS} -L$withval/lib"
+						LDFLAGS="-L${withval}/lib ${LDFLAGS}"
 					fi
 				else
 					if test -n "${need_dash_r}"; then
-						LDFLAGS="${LDFLAGS} -L$withval -R$withval"
+						LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
 					else
-						LDFLAGS="${LDFLAGS} -L$withval"
+						LDFLAGS="-L${withval} ${LDFLAGS}"
 					fi
 				fi
 				if test -d "$withval/include"; then
-					CPPFLAGS="${CPPFLAGS} -I$withval/include"
+					CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
 				else
-					CPPFLAGS="${CPPFLAGS} -I$withval"
+					CPPFLAGS="-I${withval} ${CPPFLAGS}"
 				fi
 			fi
 
@@ -377,21 +377,21 @@
 	[
 		if test -d "$withval/lib"; then
 			if test -n "${need_dash_r}"; then
-				LDFLAGS="${LDFLAGS} -L$withval/lib -R$withval/lib"
+				LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
 			else
-				LDFLAGS="${LDFLAGS} -L$withval/lib"
+				LDFLAGS="-L${withval}/lib ${LDFLAGS}"
 			fi
 		else
 			if test -n "${need_dash_r}"; then
-				LDFLAGS="${LDFLAGS} -L$withval -R$withval"
+				LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
 			else
-				LDFLAGS="${LDFLAGS} -L$withval"
+				LDFLAGS="-L${withval} ${LDFLAGS}"
 			fi
 		fi
 		if test -d "$withval/include"; then
-			CPPFLAGS="${CPPFLAGS} -I$withval/include"
+			CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
 		else
-			CPPFLAGS="${CPPFLAGS} -I$withval"
+			CPPFLAGS="-I${withval} ${CPPFLAGS}"
 		fi
 	]
 )
@@ -524,21 +524,21 @@
 			if test -n "${withval}" -a "${withval}" != "yes"; then
 				if test -d "${withval}/lib"; then
 					if test -n "${need_dash_r}"; then
-						LDFLAGS="$LDFLAGS -L${withval}/lib -R${withval}/lib"
+						LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
 					else
-						LDFLAGS="$LDFLAGS -L${withval}/lib"
+						LDFLAGS="-L${withval}/lib ${LDFLAGS}"
 					fi
 				else
 					if test -n "${need_dash_r}"; then
-						LDFLAGS="$LDFLAGS -L${withval} -R${withval}"
+						LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
 					else
-						LDFLAGS="$LDFLAGS -L${withval}"
+						LDFLAGS="-L${withval} ${LDFLAGS}"
 					fi
 				fi
 				if test -d "${withval}/include"; then
-					CPPFLAGS="$CPPFLAGS -I${withval}/include"
+					CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
 				else
-					CPPFLAGS="$CPPFLAGS -I${withval}"
+					CPPFLAGS="-I${withval} ${CPPFLAGS}"
 				fi
 			fi
 			LIBS="-lwrap $LIBS"