Skip to content

Commit 02854da

Browse files
authored
[3.6] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3344)
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 <christian@python.org> (cherry picked from commit 75b9618)
1 parent 8704d54 commit 02854da

File tree

6 files changed

+83
-5
lines changed

6 files changed

+83
-5
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
@@ -55,6 +55,11 @@ corresponding Unix manual entries for more information on calls.");
5555
#include <sys/uio.h>
5656
#endif
5757

58+
#ifdef HAVE_SYS_SYSMACROS_H
59+
/* GNU C Library: major(), minor(), makedev() */
60+
#include <sys/sysmacros.h>
61+
#endif
62+
5863
#ifdef HAVE_SYS_TYPES_H
5964
#include <sys/types.h>
6065
#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 <scott@netsplit.com>.
1919
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7822,7 +7822,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \
78227822
sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
78237823
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
78247824
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
7825-
sys/endian.h
7825+
sys/endian.h sys/sysmacros.h
78267826
do :
78277827
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
78287828
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
@@ -2068,7 +2068,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \
20682068
sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
20692069
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
20702070
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
2071-
sys/endian.h)
2071+
sys/endian.h sys/sysmacros.h)
20722072
AC_HEADER_DIRENT
20732073
AC_HEADER_MAJOR
20742074

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@
10571057
/* Define to 1 if you have the <sys/syscall.h> header file. */
10581058
#undef HAVE_SYS_SYSCALL_H
10591059

1060+
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
1061+
#undef HAVE_SYS_SYSMACROS_H
1062+
10601063
/* Define to 1 if you have the <sys/sys_domain.h> header file. */
10611064
#undef HAVE_SYS_SYS_DOMAIN_H
10621065

0 commit comments

Comments
 (0)