diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c03fc15bf808c3..7448499672cc2a 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -51,6 +51,17 @@ disguised Unix interface). Refer to the library manual and\n\ corresponding Unix manual entries for more information on calls."); +#if defined(MAJOR_IN_MKDEV) +#include +#else +#if defined(MAJOR_IN_SYSMACROS) +#include +#endif +#if defined(HAVE_MKNOD) && defined(HAVE_SYS_MKDEV_H) +#include +#endif +#endif + #ifdef HAVE_SYS_UIO_H #include #endif @@ -373,17 +384,6 @@ static int win32_can_symlink = 0; # define STRUCT_STAT struct stat #endif -#if defined(MAJOR_IN_MKDEV) -#include -#else -#if defined(MAJOR_IN_SYSMACROS) -#include -#endif -#if defined(HAVE_MKNOD) && defined(HAVE_SYS_MKDEV_H) -#include -#endif -#endif - #define DWORD_MAX 4294967295U #ifdef MS_WINDOWS diff --git a/aclocal.m4 b/aclocal.m4 index 9a9cc557281571..4a6488fcb3bc6a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -170,7 +170,7 @@ if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs diff --git a/configure b/configure index 87504d206837ba..05492a8ee9d2c6 100755 --- a/configure +++ b/configure @@ -622,6 +622,7 @@ ac_includes_default="\ # include #endif" +ac_header_list= ac_subst_vars='LTLIBOBJS ENSUREPIP SRCDIRS @@ -2609,6 +2610,7 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +as_fn_append ac_header_list " sys/types.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -7994,35 +7996,40 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 -$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if ${ac_cv_header_sys_types_h_makedev+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -return makedev(0, 0); - ; - return 0; -} + +# This works around a buggy version in autoconf <= 2.69. +# See + + + +# This is taken from the following Autoconf patch: +# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=XXXXXXX + + + + + + + + + + for ac_header in $ac_header_list +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_header_sys_types_h_makedev=yes -else - ac_cv_header_sys_types_h_makedev=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 -$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } -if test $ac_cv_header_sys_types_h_makedev = no; then +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : @@ -8031,9 +8038,8 @@ $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h fi - - if test $ac_cv_header_sys_mkdev_h = no; then - ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test $ac_cv_header_sys_mkdev_h = no; then + ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -8041,7 +8047,6 @@ $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h fi - fi fi diff --git a/configure.ac b/configure.ac index f9bd92ce3da29e..e71653e3fb2471 100644 --- a/configure.ac +++ b/configure.ac @@ -2058,6 +2058,32 @@ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h) AC_HEADER_DIRENT + +# This works around a buggy version in autoconf <= 2.69. +# See + +m4_version_prereq([2.70], [], [ + +# This is taken from the following Autoconf patch: +# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=XXXXXXX + +m4_undefine([AC_HEADER_MAJOR]) +AC_DEFUN([AC_HEADER_MAJOR], +[AC_CHECK_HEADERS_ONCE([sys/types.h]) +AC_CHECK_HEADER([sys/mkdev.h], + [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are declared in + .])]) +if test $ac_cv_header_sys_mkdev_h = no; then + AC_CHECK_HEADER([sys/sysmacros.h], + [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' are declared in + .])]) +fi +]) + +]) + AC_HEADER_MAJOR # bluetooth/bluetooth.h has been known to not compile with -std=c99.