diff options
-rw-r--r-- | Modules/posixmodule.c | 4 | ||||
-rwxr-xr-x | configure | 100 | ||||
-rw-r--r-- | configure.in | 24 | ||||
-rw-r--r-- | pyconfig.h.in | 6 |
4 files changed, 132 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6100067..e5d1178 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4604,7 +4604,7 @@ posix_mkfifo(PyObject *self, PyObject *args) #endif -#ifdef HAVE_MKNOD +#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) PyDoc_STRVAR(posix_mknod__doc__, "mknod(filename, [, mode=0600, major, minor])\n\n\ Create a filesystem node (file, device special file or named pipe)\n\ @@ -6426,7 +6426,7 @@ static PyMethodDef posix_methods[] = { #ifdef HAVE_MKFIFO {"mkfifo", posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__}, #endif -#ifdef HAVE_MKNOD +#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) {"mknod", posix_mknod, METH_VARARGS, posix_mknod__doc__}, #endif #ifdef HAVE_FTRUNCATE @@ -4316,6 +4316,106 @@ rm -f conftest* echo "$as_me:$LINENO: result: $was_it_defined" >&5 echo "${ECHO_T}$was_it_defined" >&6 +# Check whether using makedev requires defining _OSF_SOURCE +echo "$as_me:$LINENO: checking for makedev" >&5 +echo $ECHO_N "checking for makedev... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + #include <sys/types.h> +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + makedev(0, 0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_has_makedev=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_has_makedev=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_has_makedev" = "no"; then + # we didn't link, try if _OSF_SOURCE will allow us to link + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + + #define _OSF_SOURCE 1 + #include <sys/types.h> + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + makedev(0, 0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_has_makedev=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_has_makedev=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test "$ac_cv_has_makedev" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define _OSF_SOURCE 1 +_ACEOF + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_has_makedev" >&5 +echo "${ECHO_T}$ac_cv_has_makedev" >&6 +if test "$ac_cv_has_makedev" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MAKEDEV 1 +_ACEOF + +fi + # Two defines needed to enable largefile support on various platforms # These may affect some typedefs diff --git a/configure.in b/configure.in index 88a285f..7e82ca5 100644 --- a/configure.in +++ b/configure.in @@ -623,6 +623,30 @@ AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [ ]) AC_MSG_RESULT($was_it_defined) +# Check whether using makedev requires defining _OSF_SOURCE +AC_MSG_CHECKING(for makedev) +AC_TRY_LINK([ #include <sys/types.h> ], + [ makedev(0, 0) ], + ac_cv_has_makedev=yes, + ac_cv_has_makedev=no) +if test "$ac_cv_has_makedev" = "no"; then + # we didn't link, try if _OSF_SOURCE will allow us to link + AC_TRY_LINK([ + #define _OSF_SOURCE 1 + #include <sys/types.h> + ], + [ makedev(0, 0) ], + ac_cv_has_makedev=yes, + ac_cv_has_makedev=no) + if test "$ac_cv_has_makedev" = "yes"; then + AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.]) + fi +fi +AC_MSG_RESULT($ac_cv_has_makedev) +if test "$ac_cv_has_makedev" = "yes"; then + AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.]) +fi + # Two defines needed to enable largefile support on various platforms # These may affect some typedefs AC_DEFINE(_LARGEFILE_SOURCE, 1, diff --git a/pyconfig.h.in b/pyconfig.h.in index 05a355b..74625f2 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -247,6 +247,9 @@ /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT +/* Define this if you have the makedev macro. */ +#undef HAVE_MAKEDEV + /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE @@ -766,6 +769,9 @@ /* Define to 1 if on MINIX. */ #undef _MINIX +/* Define _OSF_SOURCE to get the makedev macro. */ +#undef _OSF_SOURCE + /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE |