From 24d10482b9dc0d4d54c93154dc5055b39ce224fe Mon Sep 17 00:00:00 2001
From: Tom Yu <tlyu@mit.edu>
Date: Mon, 27 Jun 1994 18:25:30 +0000
Subject: [PATCH] 	* aclocal.m4: fixes to do sane quoting of arguments
 before 	recursing.  This allows options to be set with values
 containing 	whitespace, for instance.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3919 dc483132-0cff-0310-8789-dd5450dbe970
---
 src/ChangeLog  |  4 ++++
 src/aclocal.m4 | 29 +++++++++++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 457f0ecb1..c82f8e74f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 Mon Jun 27 08:21:42 1994  Tom Yu  (tlyu at dragons-lair)
 
+	* aclocal.m4: fixes to do sane quoting of arguments before
+	recursing.  This allows options to be set with values containing
+	whitespace, for instance.
+
 	* configure.in (in all relevant subdirs): move invokations of
 	CONFIG_RULES around so that they preceed anything that even
 	vaguely resembles a compile test.  This is so that $CC will get
diff --git a/src/aclocal.m4 b/src/aclocal.m4
index b2551828f..a0e8cf05f 100644
--- a/src/aclocal.m4
+++ b/src/aclocal.m4
@@ -45,20 +45,29 @@ SUBDIRS="$1"
 if [ -z "${norecursion}" ] ; then
 	recurse_args=
 	recur_state=
-	for recur_arg in ${configure_args} ; do
-		if test -z "${recur_state}" ; then
-			case "${recur_arg}" in
-			  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-			    recur_state="skip"
-			    ;;
-			  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-			    ;;
-			*) recurse_args="${recurse_args} ${recur_arg}" ;;
+# ok this stuff really belongs in ac_general.m4, but we'll live :-)
+	set foo! "<<<$>>>@"
+	for arg do
+		shift
+		shift
+		if test -z "$recur_state" ; then
+			case $arg in
+				*\"*|*\\*|*\<<<$>>>*)
+				arg=`echo $arg|sed -e 's/\\\\/\\\\\\\\/g;s/"/\\\\"/g;s/\\$/\\\\$/g'`
+				;;
+				-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+				recur_state="skip"
+				;;
+				-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+				;;
 			esac
+			# yes this is gross but we need it to make sure that things don't get scrod
+			set foo! "<<<$>>>@" "\"$arg\""
 		else
 			recur_state=
 		fi
 	done
+	shift
 	for configdir in $1 ; do
 
 		if [ -d ${srcdir}/${configdir} ] ; then
@@ -106,7 +115,7 @@ if [ -z "${norecursion}" ] ; then
 
 ### The recursion line is here.
 			if [ ! -z "${recprog}" ] ; then
-				if eval ${config_shell} ${recprog} "${recurse_args}" ${srcdiroption}; then
+				if eval ${config_shell} ${recprog} "<<<$>>>@" ${srcdiroption}; then
 					true
 				else
 					echo Configure in `pwd` failed, exiting. 1>&2
-- 
2.26.2