Update configure to clean up if logic

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@1931 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-headers/configure b/mingw-w64-headers/configure
index 4b01fc4..bc89613 100755
--- a/mingw-w64-headers/configure
+++ b/mingw-w64-headers/configure
@@ -172,7 +172,8 @@
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
-  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
 else
@@ -563,7 +564,6 @@
 DDKHEAD_LIST
 MINGW_HAS_DX
 DXHEAD_LIST
-SDKSHEAD_LIST
 SECSYSHEAD_LIST
 SECHEAD_LIST
 SYSHEAD_LIST
@@ -571,6 +571,7 @@
 BASEHEAD_LIST
 ENABLE_CRT_FALSE
 ENABLE_CRT_TRUE
+SED
 host_os
 host_vendor
 host_cpu
@@ -2279,6 +2280,75 @@
 
 
 # Checks for programs.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
 
 # Checks for libraries.
 
@@ -2324,7 +2394,6 @@
 
 
 
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for optional sdk headers" >&5
 $as_echo_n "checking for optional sdk headers... " >&6; }
 # Check whether --enable-sdk was given.
@@ -2358,29 +2427,26 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_sdk" >&5
 $as_echo "$enable_sdk" >&6; }
 
-MINGW_HAS_DX=0
-MINGW_HAS_DDK=0
+if test "x$enable_directx" = x""yes; then :
 
-if test $enable_directx = yes; then :
+    DXHEAD_LIST=$srcdir/direct-x/include/*.[hi]*
+    MINGW_HAS_DX=1
 
-  DXHEAD_LIST=$srcdir/direct-x/include/*.[hi]*
-  MINGW_HAS_DX=1
 else
 
-#FIXME
-SDKSHEAD_LIST=$srcdir/defaults/include/sdks/*.h
-MINGW_HAS_DX=1
-#ENDFIXME Get rid of this hack!
+    MINGW_HAS_DX=0
 
 fi
 
 
 
-if test $enable_ddk = yes; then :
+if test "x$enable_ddk" = x""yes; then :
 
-  DDKHEAD_LIST=$srcdir/ddk/include/ddk/*.h
-  MINGW_HAS_DDK=1
-fi
+    DDKHEAD_LIST=$srcdir/ddk/include/ddk/*.h
+    MINGW_HAS_DDK=1
+else
+
+]])fi
 
 
 
@@ -2388,7 +2454,7 @@
 
 # Checks for library functions.
 
-ac_config_files="$ac_config_files Makefile crt/sdks/_mingw_directx.h crt/sdks/_mingw_ddk.h"
+ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -3082,8 +3148,6 @@
   case $ac_config_target in
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "crt/sdks/_mingw_directx.h") CONFIG_FILES="$CONFIG_FILES crt/sdks/_mingw_directx.h" ;;
-    "crt/sdks/_mingw_ddk.h") CONFIG_FILES="$CONFIG_FILES crt/sdks/_mingw_ddk.h" ;;
 
   *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -3699,3 +3763,4 @@
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
+
diff --git a/mingw-w64-headers/configure.ac b/mingw-w64-headers/configure.ac
index 3761420..504c2ad 100644
--- a/mingw-w64-headers/configure.ac
+++ b/mingw-w64-headers/configure.ac
@@ -68,20 +68,21 @@
   [AC_ERROR([Invalid option: $enable_sdk.  Please choose one of ddk, directx, or all.])])
 AC_MSG_RESULT([$enable_sdk])
 
-MINGW_HAS_DX=0
-MINGW_HAS_DDK=0
-
-AS_IF([test $enable_directx = yes],[
-  DXHEAD_LIST=$srcdir/direct-x/include/*.[[hi]]*
-  MINGW_HAS_DX=1],
-  [])
+AS_VAR_IF([enable_directx],[yes],[
+    DXHEAD_LIST=$srcdir/direct-x/include/*.[[hi]]*
+    MINGW_HAS_DX=1
+  ],[
+    MINGW_HAS_DX=0
+  ])
 AC_SUBST([DXHEAD_LIST])
 AC_SUBST([MINGW_HAS_DX])
 
-AS_IF([test $enable_ddk = yes],[
-  DDKHEAD_LIST=$srcdir/ddk/include/ddk/*.h
-  MINGW_HAS_DDK=1],
-  [])
+AS_VAR_IF([enable_ddk],[yes],[
+    DDKHEAD_LIST=$srcdir/ddk/include/ddk/*.h
+    MINGW_HAS_DDK=1],
+  ],[
+    MINGW_HAS_DDK=0
+  ])
 AC_SUBST([DDKHEAD_LIST])
 AC_SUBST([MINGW_HAS_DDK])
 
@@ -91,3 +92,4 @@
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
+