Added WINE_CHECK_DEFINE macro to factor out some repeated code.

diff --git a/aclocal.m4 b/aclocal.m4
index ead087e..95c6c31 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -94,6 +94,22 @@
 AC_TRY_LINK([],[],[$2],[$3])
 CFLAGS=$ac_wine_try_cflags_saved])
 
+dnl **** Check whether we need to define a symbol on the compiler command line ****
+dnl
+dnl Usage: WINE_CHECK_DEFINE(name),[action-if-yes,[action-if-no]])
+dnl
+AC_DEFUN([WINE_CHECK_DEFINE],
+[AS_VAR_PUSHDEF([ac_var],[ac_cv_cpp_def_$1])dnl
+AC_CACHE_CHECK([whether we need to define $1],ac_var,
+    AC_EGREP_CPP(yes,[#ifndef $1
+yes
+#endif],
+    [AS_VAR_SET(ac_var,yes)],[AS_VAR_SET(ac_var,no)]))
+AS_IF([test AS_VAR_GET(ac_var) = yes],
+      [CFLAGS="$CFLAGS -D$1"
+  LINTFLAGS="$LINTFLAGS -D$1"])dnl
+AS_VAR_POPDEF([ac_var])])
+
 dnl **** Check for ln ****
 dnl
 dnl Usage: WINE_PROG_LN
diff --git a/configure b/configure
index 9b054f1..5917ba0 100755
--- a/configure
+++ b/configure
@@ -13616,10 +13616,9 @@
 
 
 case $host_cpu in
-  *i345678986* )
-    echo "$as_me:$LINENO: checking whether we need to define __i386__" >&5
+  *i[3456789]86*) echo "$as_me:$LINENO: checking whether we need to define __i386__" >&5
 echo $ECHO_N "checking whether we need to define __i386__... $ECHO_C" >&6
-if test "${ac_cv_cpp_def_i386+set}" = set; then
+if test "${ac_cv_cpp_def___i386__+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -13631,29 +13630,23 @@
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   $EGREP "yes" >/dev/null 2>&1; then
-  ac_cv_cpp_def_i386="yes"
+  ac_cv_cpp_def___i386__=yes
 else
-  ac_cv_cpp_def_i386="no"
+  ac_cv_cpp_def___i386__=no
 fi
 rm -f conftest*
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cpp_def_i386" >&5
-echo "${ECHO_T}$ac_cv_cpp_def_i386" >&6
-    ;;
-esac
-if test "$ac_cv_cpp_def_i386" = "yes"
-then
-    CFLAGS="$CFLAGS -D__i386__"
-    LINTFLAGS="$LINTFLAGS -D__i386__"
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___i386__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___i386__" >&6
+if test $ac_cv_cpp_def___i386__ = yes; then
+  CFLAGS="$CFLAGS -D__i386__"
+  LINTFLAGS="$LINTFLAGS -D__i386__"
 fi
-
-
-case $host_cpu in
-  *alpha* )
-    echo "$as_me:$LINENO: checking whether we need to define __ALPHA__" >&5
+ ;;
+  *alpha*)          echo "$as_me:$LINENO: checking whether we need to define __ALPHA__" >&5
 echo $ECHO_N "checking whether we need to define __ALPHA__... $ECHO_C" >&6
-if test "${ac_cv_cpp_def_alpha+set}" = set; then
+if test "${ac_cv_cpp_def___ALPHA__+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -13665,29 +13658,23 @@
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   $EGREP "yes" >/dev/null 2>&1; then
-  ac_cv_cpp_def_alpha="yes"
+  ac_cv_cpp_def___ALPHA__=yes
 else
-  ac_cv_cpp_def_alpha="no"
+  ac_cv_cpp_def___ALPHA__=no
 fi
 rm -f conftest*
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cpp_def_alpha" >&5
-echo "${ECHO_T}$ac_cv_cpp_def_alpha" >&6
-    ;;
-esac
-if test "$ac_cv_cpp_def_alpha" = "yes"
-then
-    CFLAGS="$CFLAGS -D__ALPHA__"
-    LINTFLAGS="$LINTFLAGS -D__ALPHA__"
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___ALPHA__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___ALPHA__" >&6
+if test $ac_cv_cpp_def___ALPHA__ = yes; then
+  CFLAGS="$CFLAGS -D__ALPHA__"
+  LINTFLAGS="$LINTFLAGS -D__ALPHA__"
 fi
-
-
-case $host_cpu in
-  *sparc* )
-    echo "$as_me:$LINENO: checking whether we need to define __sparc__" >&5
+ ;;
+  *sparc*)          echo "$as_me:$LINENO: checking whether we need to define __sparc__" >&5
 echo $ECHO_N "checking whether we need to define __sparc__... $ECHO_C" >&6
-if test "${ac_cv_cpp_def_sparc+set}" = set; then
+if test "${ac_cv_cpp_def___sparc__+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -13699,29 +13686,26 @@
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   $EGREP "yes" >/dev/null 2>&1; then
-  ac_cv_cpp_def_sparc="yes"
+  ac_cv_cpp_def___sparc__=yes
 else
-  ac_cv_cpp_def_sparc="no"
+  ac_cv_cpp_def___sparc__=no
 fi
 rm -f conftest*
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cpp_def_sparc" >&5
-echo "${ECHO_T}$ac_cv_cpp_def_sparc" >&6
-    ;;
-esac
-if test "$ac_cv_cpp_def_sparc" = "yes"
-then
-    CFLAGS="$CFLAGS -D__sparc__"
-    LINTFLAGS="$LINTFLAGS -D__sparc__"
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___sparc__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___sparc__" >&6
+if test $ac_cv_cpp_def___sparc__ = yes; then
+  CFLAGS="$CFLAGS -D__sparc__"
+  LINTFLAGS="$LINTFLAGS -D__sparc__"
 fi
-
+ ;;
+esac
 
 case $host_vendor in
-  *sun* )
-    echo "$as_me:$LINENO: checking whether we need to define __sun__" >&5
+  *sun*) echo "$as_me:$LINENO: checking whether we need to define __sun__" >&5
 echo $ECHO_N "checking whether we need to define __sun__... $ECHO_C" >&6
-if test "${ac_cv_cpp_def_sun+set}" = set; then
+if test "${ac_cv_cpp_def___sun__+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -13733,22 +13717,21 @@
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   $EGREP "yes" >/dev/null 2>&1; then
-  ac_cv_cpp_def_sun="yes"
+  ac_cv_cpp_def___sun__=yes
 else
-  ac_cv_cpp_def_sun="no"
+  ac_cv_cpp_def___sun__=no
 fi
 rm -f conftest*
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cpp_def_sun" >&5
-echo "${ECHO_T}$ac_cv_cpp_def_sun" >&6
-    ;;
-esac
-if test "$ac_cv_cpp_def_sun" = "yes"
-then
-    CFLAGS="$CFLAGS -D__sun__"
-    LINTFLAGS="$LINTFLAGS -D__sun__"
+echo "$as_me:$LINENO: result: $ac_cv_cpp_def___sun__" >&5
+echo "${ECHO_T}$ac_cv_cpp_def___sun__" >&6
+if test $ac_cv_cpp_def___sun__ = yes; then
+  CFLAGS="$CFLAGS -D__sun__"
+  LINTFLAGS="$LINTFLAGS -D__sun__"
 fi
+ ;;
+esac
 
 
 
diff --git a/configure.ac b/configure.ac
index 7eef841..44ad8a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1292,73 +1292,17 @@
 #endif],
     [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN, 1, [Define if struct sockaddr_un contains sun_len])])
 
-dnl *** check for the need to define __i386__
+dnl *** check for the need to define platform-specific symbols
 
 case $host_cpu in
-  *i[3456789]86* )
-    AC_CACHE_CHECK([whether we need to define __i386__],ac_cv_cpp_def_i386,
-      AC_EGREP_CPP(yes,[#ifndef __i386__
-yes
-#endif],
- ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
-    ;;
+  *i[[3456789]]86*) WINE_CHECK_DEFINE([__i386__]) ;;
+  *alpha*)          WINE_CHECK_DEFINE([__ALPHA__]) ;;
+  *sparc*)          WINE_CHECK_DEFINE([__sparc__]) ;;
 esac
-if test "$ac_cv_cpp_def_i386" = "yes"
-then
-    CFLAGS="$CFLAGS -D__i386__"
-    LINTFLAGS="$LINTFLAGS -D__i386__"
-fi
-
-dnl *** check for the need to define __ALPHA__
-
-case $host_cpu in
-  *alpha* )
-    AC_CACHE_CHECK([whether we need to define __ALPHA__],ac_cv_cpp_def_alpha,
-      AC_EGREP_CPP(yes,[#ifndef __ALPHA__
-yes
-#endif],
- ac_cv_cpp_def_alpha="yes", ac_cv_cpp_def_alpha="no"))
-    ;;
-esac
-if test "$ac_cv_cpp_def_alpha" = "yes"
-then
-    CFLAGS="$CFLAGS -D__ALPHA__"
-    LINTFLAGS="$LINTFLAGS -D__ALPHA__"
-fi
-
-dnl *** check for the need to define __sparc__
-
-case $host_cpu in
-  *sparc* )
-    AC_CACHE_CHECK([whether we need to define __sparc__],ac_cv_cpp_def_sparc,
-      AC_EGREP_CPP(yes,[#ifndef __sparc__
-yes
-#endif],
- ac_cv_cpp_def_sparc="yes", ac_cv_cpp_def_sparc="no"))
-    ;;
-esac
-if test "$ac_cv_cpp_def_sparc" = "yes"
-then
-    CFLAGS="$CFLAGS -D__sparc__"
-    LINTFLAGS="$LINTFLAGS -D__sparc__"
-fi
-
-dnl *** check for the need to define __sun__
 
 case $host_vendor in
-  *sun* )
-    AC_CACHE_CHECK([whether we need to define __sun__],ac_cv_cpp_def_sun,
-      AC_EGREP_CPP(yes,[#ifndef __sun__
-yes
-#endif],
- ac_cv_cpp_def_sun="yes", ac_cv_cpp_def_sun="no"))
-    ;;
+  *sun*) WINE_CHECK_DEFINE([__sun__]) ;;
 esac
-if test "$ac_cv_cpp_def_sun" = "yes"
-then
-    CFLAGS="$CFLAGS -D__sun__"
-    LINTFLAGS="$LINTFLAGS -D__sun__"
-fi
 
 dnl **** Generate output files ****