]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #26932: Fixed support of RTLD_* constants defined as enum values,
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 4 May 2016 06:44:44 +0000 (09:44 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 4 May 2016 06:44:44 +0000 (09:44 +0300)
not via macros (in particular on Android).  Patch by Chi Hsuan Yen.

Misc/NEWS
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callproc.c
Modules/posixmodule.c
Python/pystate.c
configure
configure.ac
pyconfig.h.in

index 46cd9ca30497fb131b0d6686c0e58844a4445745..bae8c7bba44b3951d31ca82c585626635826eed5 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1045,6 +1045,9 @@ Tests
 Build
 -----
 
+- Issue #26932: Fixed support of RTLD_* constants defined as enum values,
+  not via macros (in particular on Android).  Patch by Chi Hsuan Yen.
+
 - Issue #22359: Disable the rules for running _freeze_importlib and pgen when
   cross-compiling.  The output of these programs is normally saved with the
   source code anyway, and is still regenerated when doing a native build.
index 6b1e74434f5c324f65a34b2b3649f696f5fcde09..33a7f90233d00c18985e2209f8803b169cce8d29 100644 (file)
@@ -5480,14 +5480,14 @@ PyInit__ctypes(void)
 #endif
 
 /* If RTLD_LOCAL is not defined (Windows!), set it to zero. */
-#ifndef RTLD_LOCAL
+#if !HAVE_DECL_RTLD_LOCAL
 #define RTLD_LOCAL 0
 #endif
 
 /* If RTLD_GLOBAL is not defined (cygwin), set it to the same value as
    RTLD_LOCAL.
 */
-#ifndef RTLD_GLOBAL
+#if !HAVE_DECL_RTLD_GLOBAL
 #define RTLD_GLOBAL RTLD_LOCAL
 #endif
 
index 870a0d44288b612689e34e91a6250e31a8d72dbf..9ab0723c65f58613709601fdf47afa5bf95aa0b4 100644 (file)
@@ -1307,7 +1307,7 @@ static PyObject *py_dl_open(PyObject *self, PyObject *args)
     PyObject *name, *name2;
     char *name_str;
     void * handle;
-#ifdef RTLD_LOCAL
+#if HAVE_DECL_RTLD_LOCAL
     int mode = RTLD_NOW | RTLD_LOCAL;
 #else
     /* cygwin doesn't define RTLD_LOCAL */
index 03ad07d813e97222591348e117596c2cfb3d4514..23b2a3c59b99b214a125a3950d3029853f546609 100644 (file)
@@ -12895,25 +12895,25 @@ all_ins(PyObject *m)
     if (PyModule_AddIntMacro(m, XATTR_SIZE_MAX)) return -1;
 #endif
 
-#ifdef RTLD_LAZY
+#if HAVE_DECL_RTLD_LAZY
     if (PyModule_AddIntMacro(m, RTLD_LAZY)) return -1;
 #endif
-#ifdef RTLD_NOW
+#if HAVE_DECL_RTLD_NOW
     if (PyModule_AddIntMacro(m, RTLD_NOW)) return -1;
 #endif
-#ifdef RTLD_GLOBAL
+#if HAVE_DECL_RTLD_GLOBAL
     if (PyModule_AddIntMacro(m, RTLD_GLOBAL)) return -1;
 #endif
-#ifdef RTLD_LOCAL
+#if HAVE_DECL_RTLD_LOCAL
     if (PyModule_AddIntMacro(m, RTLD_LOCAL)) return -1;
 #endif
-#ifdef RTLD_NODELETE
+#if HAVE_DECL_RTLD_NODELETE
     if (PyModule_AddIntMacro(m, RTLD_NODELETE)) return -1;
 #endif
-#ifdef RTLD_NOLOAD
+#if HAVE_DECL_RTLD_NOLOAD
     if (PyModule_AddIntMacro(m, RTLD_NOLOAD)) return -1;
 #endif
-#ifdef RTLD_DEEPBIND
+#if HAVE_DECL_RTLD_DEEPBIND
     if (PyModule_AddIntMacro(m, RTLD_DEEPBIND)) return -1;
 #endif
 
index 0503f32670045aa217b7363c839a75116eadd813..ba4dd4c2b5f37ca20f8b9c5afb30053b074f2e50 100644 (file)
@@ -25,7 +25,7 @@ to avoid the expense of doing their own locking).
 #ifdef HAVE_DLFCN_H
 #include <dlfcn.h>
 #endif
-#ifndef RTLD_LAZY
+#if !HAVE_DECL_RTLD_LAZY
 #define RTLD_LAZY 1
 #endif
 #endif
@@ -91,7 +91,7 @@ PyInterpreterState_New(void)
         interp->fscodec_initialized = 0;
         interp->importlib = NULL;
 #ifdef HAVE_DLOPEN
-#ifdef RTLD_NOW
+#if HAVE_DECL_RTLD_NOW
         interp->dlopenflags = RTLD_NOW;
 #else
         interp->dlopenflags = RTLD_LAZY;
index a961f3971218c8949164ff103626aa61b5c563ad..a009afe4ca26808e4e0548f86b22f0d8858bca5c 100755 (executable)
--- a/configure
+++ b/configure
@@ -14255,6 +14255,85 @@ $as_echo "#define HAVE_BROKEN_SEM_GETVALUE 1" >>confdefs.h
 
 fi
 
+ac_fn_c_check_decl "$LINENO" "RTLD_LAZY" "ac_cv_have_decl_RTLD_LAZY" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_LAZY" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_LAZY $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "RTLD_NOW" "ac_cv_have_decl_RTLD_NOW" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_NOW" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_NOW $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "RTLD_GLOBAL" "ac_cv_have_decl_RTLD_GLOBAL" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_GLOBAL" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_GLOBAL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "RTLD_LOCAL" "ac_cv_have_decl_RTLD_LOCAL" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_LOCAL" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_LOCAL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "RTLD_NODELETE" "ac_cv_have_decl_RTLD_NODELETE" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_NODELETE" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_NODELETE $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "RTLD_NOLOAD" "ac_cv_have_decl_RTLD_NOLOAD" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_NOLOAD" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_NOLOAD $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "RTLD_DEEPBIND" "ac_cv_have_decl_RTLD_DEEPBIND" "#include <dlfcn.h>
+"
+if test "x$ac_cv_have_decl_RTLD_DEEPBIND" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RTLD_DEEPBIND $ac_have_decl
+_ACEOF
+
+
 # determine what size digit to use for Python's longs
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking digit size for Python's longs" >&5
 $as_echo_n "checking digit size for Python's longs... " >&6; }
index bfd2b0405148118a77ae2c1b753e122ebe47d0b2..f947af95d798e06b1390afed45962671bd30092e 100644 (file)
@@ -4342,6 +4342,8 @@ then
   [define to 1 if your sem_getvalue is broken.])
 fi
 
+AC_CHECK_DECLS([RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, RTLD_LOCAL, RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEEPBIND], [], [], [[#include <dlfcn.h>]])
+
 # determine what size digit to use for Python's longs
 AC_MSG_CHECKING([digit size for Python's longs])
 AC_ARG_ENABLE(big-digits,
index b51bd56fd62366726693929f2e8b10e94707637b..0451855cc58f8e52852d2bc261756bdd3ef67d72 100644 (file)
    */
 #undef HAVE_DECL_ISNAN
 
+/* Define to 1 if you have the declaration of `RTLD_DEEPBIND', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_DEEPBIND
+
+/* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_GLOBAL
+
+/* Define to 1 if you have the declaration of `RTLD_LAZY', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_LAZY
+
+/* Define to 1 if you have the declaration of `RTLD_LOCAL', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_LOCAL
+
+/* Define to 1 if you have the declaration of `RTLD_NODELETE', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_NODELETE
+
+/* Define to 1 if you have the declaration of `RTLD_NOLOAD', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_NOLOAD
+
+/* Define to 1 if you have the declaration of `RTLD_NOW', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RTLD_NOW
+
 /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
    */
 #undef HAVE_DECL_TZNAME