Fix a mistake in how AC_PATH_PROGS works

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5191 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-headers/configure b/mingw-w64-headers/configure
index 2acbc7e..cf08f5f 100755
--- a/mingw-w64-headers/configure
+++ b/mingw-w64-headers/configure
@@ -2449,16 +2449,22 @@
   with_widl=no
 fi
 
-
 case $with_widl in #(
   no) :
-    with_widl= ;; #(
+     ;; #(
   yes) :
     with_widl="mingw-w64-widl widl" ;; #(
   *) :
      ;;
 esac
-for ac_prog in $with_widl
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_widl" >&5
+$as_echo "$with_widl" >&6; }
+
+if test "x$with_widl" = xno; then :
+
+else
+
+  for ac_prog in $with_widl
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -2503,6 +2509,11 @@
   test -n "$WIDL" && break
 done
 
+  if ${WIDL:+false} :; then :
+  as_fn_error $? "Could not find widl installation, which is required in maintainer mode" "$LINENO" 5
+fi
+fi
+
  if ${WIDL+:} false; then
   HAVE_WIDL_TRUE=
   HAVE_WIDL_FALSE='#'
@@ -2511,13 +2522,6 @@
   HAVE_WIDL_FALSE=
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WIDL" >&5
-$as_echo "$WIDL" >&6; }
-if ${WIDL+:} false; then :
-
-else
-  as_fn_error $? "Could not find widl installation, which is required in maintainer mode" "$LINENO" 5
-fi
 
 # Checks for libraries.
 
diff --git a/mingw-w64-headers/configure.ac b/mingw-w64-headers/configure.ac
index 7c08346..bf9133d 100644
--- a/mingw-w64-headers/configure.ac
+++ b/mingw-w64-headers/configure.ac
@@ -20,16 +20,18 @@
   AS_HELP_STRING([--with-widl=PATH],
     [use widl to update idl-based headers]),
   [],
-  [with_widl=no])
-
+  [AS_VAR_SET([with_widl],[no])])
 AS_CASE([$with_widl],
-  [no],[AS_VAR_SET([with_widl])],
+  [no],[],
   [yes],[AS_VAR_SET([with_widl],["mingw-w64-widl widl"])],
   [])
-AC_PATH_PROGS([WIDL], [$with_widl], [])
+AC_MSG_RESULT([$with_widl])
+
+AS_VAR_IF([with_widl],[no],[],[
+  AC_PATH_PROGS([WIDL], [$with_widl], [])
+  AS_VAR_IF([WIDL],[],[AC_MSG_ERROR([Could not find widl installation, which is required in maintainer mode])])])
+
 AM_CONDITIONAL([HAVE_WIDL],[AS_VAR_TEST_SET([WIDL])])
-AC_MSG_RESULT([$WIDL])
-AS_VAR_SET_IF([WIDL],[],[AC_MSG_ERROR([Could not find widl installation, which is required in maintainer mode])])
 
 # Checks for libraries.