fixes #752 configure script could be more robust
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad835d6..8f10ba8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,13 +163,14 @@
     set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} ws2_32)
     set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} mswsock)
     set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} advapi32)
-    nn_check_func (InitializeConditionVariable NN_HAVE_CONDVAR)
+    nn_check_sym (InitializeConditionVariable windows.h NN_HAVE_CONDVAR)
     if (NOT NN_HAVE_CONDVAR)
-        message (ERROR "Modern Windows API support is missing.")
-        message (ERROR "Versions of Windows prior to Vista are not supported.")
-        message (ERROR "Further, the 32-bit MinGW environment is not supported.")
-        message (ERROR "Ensure you have at least Windows Vista or newer, and are")
-        message (ERROR "using either Visual Studio 2010 or newer or MinGW-W64.")
+        message (FATAL_ERROR
+	    "Modern Windows API support is missing. "
+	    "Versions of Windows prior to Vista are not supported.  "
+	    "Further, the 32-bit MinGW environment is not supported. "
+	    "Ensure you have at least Windows Vista or newer, and are "
+	    "using either Visual Studio 2010 or newer or MinGW-W64.")
     endif()
 else ()
     # Unconditionally declare the following feature test macros.  These are
diff --git a/configure b/configure
index 5c36372..bcbf7dc 100755
--- a/configure
+++ b/configure
@@ -29,21 +29,26 @@
 
 strip_arg()
 {
-	echo "$1" | sed "s/[^=]*=//"
+	x=`echo "$1" | sed "s/[^=]*=//"`
+	eval $2=\"$x\"
 }
 
 warn() {
-	echo "$*" 2>&1
+	echo "$*" 1>&2
 }
 
 find_prog() {
-	for p in `echo "$PATH" | sed 's/:/ /'`; do
+	SIFS="${IFS=	 }"
+	IFS=:
+	for p in $PATH; do
 		if [ -x ${p}/$1 ]
 		then
+			IFS="${SIFS}"
 			echo "${p}/${1}"
 			return 0
 		fi
 	done
+	IFS="${SIFS}"
 	return 1
 }
 
@@ -68,8 +73,8 @@
 	exit 1
 }
 
+CMAKE_ARGS=()
 # Argument parsing
-#
 while [ -n "$1" ]; do
 	case "$1" in
 	--with-cmake)
@@ -77,15 +82,16 @@
 		shift 2
 		;;
 	--with-cmake=*)
-		CMAKE=`strip_arg "$1"`
+		strip_arg "$1" CMAKE
 		shift
 		;;
 	--prefix)
-		PREFIX="-DCMAKE_INSTALL_PREFIX=$2"
+		CMAKE_ARGS+=( "-DCMAKE_INSTALL_PREFIX=$2" )
 		shift 2
 		;;
 	--prefix=*)
-		PREFIX=-DCMAKE_INSTALL_PREFIX=`strip_arg "$1"`
+		strip_arg "$1" PFX
+		CMAKE_ARGS+=( "-DCMAKE_INSTALL_PREFIX=$PFX" )
 		shift
 		;;
 	*)
@@ -100,9 +106,9 @@
 
 if [ -f src/nn.h ]
 then
-	warn "NB: In-tree building is not recommended."
+	warn "NOTE: Building in the source directory is not recommended."
 fi
 
 GENERATOR="Unix Makefiles"
 
-$CMAKE $PREFIX -G "$GENERATOR" $SRCDIR
+"$CMAKE" "${CMAKE_ARGS[@]}" -G "$GENERATOR" $SRCDIR