Skip to content

Commit ffa7011

Browse files
authored
[2.7] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3345)
Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray plans to remove the functions from sys/types.h. Signed-off-by: Christian Heimes <[email protected]>. (cherry picked from commit 75b9618)
1 parent 72ed233 commit ffa7011

File tree

6 files changed

+85
-6
lines changed

6 files changed

+85
-6
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray
2+
plans to remove the functions from sys/types.h.

Modules/posixmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ corresponding Unix manual entries for more information on calls.");
6565
#include "osdefs.h"
6666
#endif
6767

68+
#ifdef HAVE_SYS_SYSMACROS_H
69+
/* GNU C Library: major(), minor(), makedev() */
70+
#include <sys/sysmacros.h>
71+
#endif
72+
6873
#ifdef HAVE_SYS_TYPES_H
6974
#include <sys/types.h>
7075
#endif /* HAVE_SYS_TYPES_H */

aclocal.m4

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# PARTICULAR PURPOSE.
1313

1414
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15-
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16-
dnl serial 11 (pkg-config-0.29.1)
17-
dnl
15+
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16+
# serial 11 (pkg-config-0.29.1)
17+
1818
dnl Copyright © 2004 Scott James Remnant <[email protected]>.
1919
dnl Copyright © 2012-2015 Dan Nicholson <[email protected]>
2020
dnl
@@ -288,3 +288,71 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
288288
AS_VAR_IF([$1], [""], [$5], [$4])dnl
289289
])dnl PKG_CHECK_VAR
290290

291+
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
292+
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
293+
dnl [DESCRIPTION], [DEFAULT])
294+
dnl ------------------------------------------
295+
dnl
296+
dnl Prepare a "--with-" configure option using the lowercase
297+
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
298+
dnl PKG_CHECK_MODULES in a single macro.
299+
AC_DEFUN([PKG_WITH_MODULES],
300+
[
301+
m4_pushdef([with_arg], m4_tolower([$1]))
302+
303+
m4_pushdef([description],
304+
[m4_default([$5], [build with ]with_arg[ support])])
305+
306+
m4_pushdef([def_arg], [m4_default([$6], [auto])])
307+
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
308+
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
309+
310+
m4_case(def_arg,
311+
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
312+
[m4_pushdef([with_without],[--with-]with_arg)])
313+
314+
AC_ARG_WITH(with_arg,
315+
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
316+
[AS_TR_SH([with_]with_arg)=def_arg])
317+
318+
AS_CASE([$AS_TR_SH([with_]with_arg)],
319+
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
320+
[auto],[PKG_CHECK_MODULES([$1],[$2],
321+
[m4_n([def_action_if_found]) $3],
322+
[m4_n([def_action_if_not_found]) $4])])
323+
324+
m4_popdef([with_arg])
325+
m4_popdef([description])
326+
m4_popdef([def_arg])
327+
328+
])dnl PKG_WITH_MODULES
329+
330+
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
331+
dnl [DESCRIPTION], [DEFAULT])
332+
dnl -----------------------------------------------
333+
dnl
334+
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
335+
dnl check._[VARIABLE-PREFIX] is exported as make variable.
336+
AC_DEFUN([PKG_HAVE_WITH_MODULES],
337+
[
338+
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
339+
340+
AM_CONDITIONAL([HAVE_][$1],
341+
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
342+
])dnl PKG_HAVE_WITH_MODULES
343+
344+
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
345+
dnl [DESCRIPTION], [DEFAULT])
346+
dnl ------------------------------------------------------
347+
dnl
348+
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
349+
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
350+
dnl and preprocessor variable.
351+
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
352+
[
353+
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
354+
355+
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
356+
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
357+
])dnl PKG_HAVE_DEFINE_WITH_MODULES
358+

configure

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,7 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
29632963
fi
29642964
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
29652965
$as_echo "$interp" >&6; }
2966-
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
2966+
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
29672967
fi
29682968
elif test "$cross_compiling" = maybe; then
29692969
as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
@@ -6399,6 +6399,7 @@ if test "$Py_OPT" = 'true' ; then
63996399
# compile working code using it and both test_distutils and test_gdb are
64006400
# broken when you do managed to get a toolchain that works with it. People
64016401
# who want LTO need to use --with-lto themselves.
6402+
Py_LTO='true'
64026403
DEF_MAKE_ALL_RULE="profile-opt"
64036404
REQUIRE_PGO="yes"
64046405
DEF_MAKE_RULE="build_all"
@@ -7045,7 +7046,7 @@ sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/
70457046
sys/termio.h sys/time.h \
70467047
sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
70477048
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
7048-
bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h
7049+
bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h
70497050
do :
70507051
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
70517052
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/
17021702
sys/termio.h sys/time.h \
17031703
sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
17041704
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1705-
bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h)
1705+
bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
17061706
AC_HEADER_DIRENT
17071707
AC_HEADER_MAJOR
17081708

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,9 @@
799799
/* Define to 1 if you have the <sys/stat.h> header file. */
800800
#undef HAVE_SYS_STAT_H
801801

802+
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
803+
#undef HAVE_SYS_SYSMACROS_H
804+
802805
/* Define to 1 if you have the <sys/termio.h> header file. */
803806
#undef HAVE_SYS_TERMIO_H
804807

0 commit comments

Comments
 (0)