Drop usage of test -e in configure as it is not portable.
Fixes #1439538
Will backport to 2.4
Also regenerate pyconfig.h.in.
diff --git a/Misc/NEWS b/Misc/NEWS
index efe6cff..9eeeff8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -177,6 +177,11 @@
   ``test_uuid`` and ``test_email_codecs`` didn't actually run any tests when
   run via ``regrtest.py``. Now they do.
 
+Build
+-----
+
+- Bug #1439538: Drop usage of test -e in configure as it is not portable.
+
 
 What's New in Python 2.5 beta 2?
 ================================
diff --git a/configure b/configure
index f7f99eb..ccdf62e 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 47023 .
+# From configure.in Revision: 47267 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for python 2.5.
 #
@@ -22040,38 +22040,55 @@
 
 echo "$as_me:$LINENO: checking for /dev/ptmx" >&5
 echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6
-
-if test -e /dev/ptmx
-then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+if test "${ac_cv_file__dev_ptmx+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "/dev/ptmx"; then
+  ac_cv_file__dev_ptmx=yes
+else
+  ac_cv_file__dev_ptmx=no
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptmx" >&5
+echo "${ECHO_T}$ac_cv_file__dev_ptmx" >&6
+if test $ac_cv_file__dev_ptmx = yes; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_DEV_PTMX 1
 _ACEOF
 
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
 fi
 
 echo "$as_me:$LINENO: checking for /dev/ptc" >&5
 echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6
-
-if test -e /dev/ptc
-then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+if test "${ac_cv_file__dev_ptc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "/dev/ptc"; then
+  ac_cv_file__dev_ptc=yes
+else
+  ac_cv_file__dev_ptc=no
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptc" >&5
+echo "${ECHO_T}$ac_cv_file__dev_ptc" >&6
+if test $ac_cv_file__dev_ptc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_DEV_PTC 1
 _ACEOF
 
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
 fi
 
+
 echo "$as_me:$LINENO: checking for %zd printf() format support" >&5
 echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6
 if test "$cross_compiling" = yes; then
diff --git a/configure.in b/configure.in
index 29242cf..54cd3c1 100644
--- a/configure.in
+++ b/configure.in
@@ -3342,27 +3342,8 @@
   AC_MSG_RESULT(no)
 )
 
-AC_MSG_CHECKING(for /dev/ptmx)
-
-if test -e /dev/ptmx
-then
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(HAVE_DEV_PTMX, 1,
-  [Define if we have /dev/ptmx.])
-else
-  AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for /dev/ptc)
-
-if test -e /dev/ptc
-then
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(HAVE_DEV_PTC, 1,
-  [Define if we have /dev/ptc.])
-else
-  AC_MSG_RESULT(no)
-fi
+AC_CHECK_FILE(/dev/ptmx, AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if we have /dev/ptmx.]))
+AC_CHECK_FILE(/dev/ptc, AC_DEFINE(HAVE_DEV_PTC, 1, [Define if we have /dev/ptc.]))
 
 AC_MSG_CHECKING(for %zd printf() format support)
 AC_TRY_RUN([#include <stdio.h>
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 7598504..a3d7f6e 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -85,6 +85,15 @@
 /* Define to 1 if you have the <curses.h> header file. */
 #undef HAVE_CURSES_H
 
+/* Define if you have the 'is_term_resized' function. */
+#undef HAVE_CURSES_IS_TERM_RESIZED
+
+/* Define if you have the 'resizeterm' function. */
+#undef HAVE_CURSES_RESIZETERM
+
+/* Define if you have the 'resize_term' function. */
+#undef HAVE_CURSES_RESIZE_TERM
+
 /* Define to 1 if you have the device macros. */
 #undef HAVE_DEVICE_MACROS
 
@@ -398,15 +407,6 @@
 /* Define to 1 if you have the `realpath' function. */
 #undef HAVE_REALPATH
 
-/* Define to 1 if you have the `is_term_resized' function. */
-#undef HAVE_CURSES_IS_TERM_RESIZED
-
-/* Define to 1 if you have the `resize_term' function. */
-#undef HAVE_CURSES_RESIZE_TERM
-
-/* Define to 1 if you have the `resizeterm' function. */
-#undef HAVE_CURSES_RESIZETERM
-
 /* Define if you have readline 2.1 */
 #undef HAVE_RL_CALLBACK