[Python-checkins] cpython (3.2): Improve the test for dirfd(), some systems #define it rather than have
gregory.p.smith
python-checkins at python.org
Sun Jan 22 03:22:07 CET 2012
http://hg.python.org/cpython/rev/07bea5e8ad5f
changeset: 74571:07bea5e8ad5f
branch: 3.2
parent: 74568:5be3dadd2eef
user: Gregory P. Smith <greg at krypto.org>
date: Sat Jan 21 18:20:15 2012 -0800
summary:
Improve the test for dirfd(), some systems #define it rather than have
an actual function.
files:
configure | 126 ++++++++++++++++++++-----------------
configure.in | 8 ++-
pyconfig.h.in | 2 +-
3 files changed, 76 insertions(+), 60 deletions(-)
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -2248,63 +2248,6 @@
} # ac_fn_c_check_func
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if eval \${$4+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$4=yes"
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$4=yes"
-else
- eval "$4=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$4
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_member
-
# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
# ---------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
@@ -2350,6 +2293,63 @@
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_decl
+
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_member
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -9410,7 +9410,7 @@
# checks for library functions
for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \
+ clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \
@@ -9435,6 +9435,16 @@
done
+ac_fn_c_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include <sys/types.h>
+ #include <dirent.h>
+"
+if test "x$ac_cv_have_decl_dirfd" = xyes; then :
+
+$as_echo "#define HAVE_DIRFD 1" >>confdefs.h
+
+fi
+
+
# For some functions, having a definition is not sufficient, since
# we want to take their address.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for chroot" >&5
diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -2587,7 +2587,7 @@
# checks for library functions
AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \
+ clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \
@@ -2601,6 +2601,12 @@
truncate uname unsetenv utimes waitpid wait3 wait4 \
wcscoll wcsftime wcsxfrm _getpty)
+AC_CHECK_DECL(dirfd,
+ AC_DEFINE(HAVE_DIRFD, 1,
+ Define if you have the 'dirfd' function or macro.), ,
+ [#include <sys/types.h>
+ #include <dirent.h>])
+
# For some functions, having a definition is not sufficient, since
# we want to take their address.
AC_MSG_CHECKING(for chroot)
diff --git a/pyconfig.h.in b/pyconfig.h.in
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -178,7 +178,7 @@
*/
#undef HAVE_DIRENT_H
-/* Define to 1 if you have the `dirfd' function. */
+/* Define if you have the 'dirfd' function or macro. */
#undef HAVE_DIRFD
/* Define to 1 if you have the <dlfcn.h> header file. */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list