From a5bdee0bb6262fb3f1dfbd4ba09a2ab438599604 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 3 Jan 2023 16:23:29 +0100 Subject: [PATCH] C99 compatibility fixes Related to: --- openpgm-c99.patch | 32 ++++++++++++++++++++++++++++++++ openpgm-configure-c99.patch | 18 ++++++++++++++++++ openpgm.spec | 4 ++++ 3 files changed, 54 insertions(+) create mode 100644 openpgm-c99.patch create mode 100644 openpgm-configure-c99.patch diff --git a/openpgm-c99.patch b/openpgm-c99.patch new file mode 100644 index 0000000..b337b57 --- /dev/null +++ b/openpgm-c99.patch @@ -0,0 +1,32 @@ +Include for the setgroups function. This avoids an implicit +function declaration and build failures with C99 compilers that do not +support them. + +Submitted upstream: + +diff -ur openpgm-release-5-2-122.orig/openpgm/pgm/configure.ac openpgm-release-5-2-122/openpgm/pgm/configure.ac +--- openpgm-release-5-2-122.orig/openpgm/pgm/configure.ac 2012-12-04 03:56:54.000000000 +0100 ++++ openpgm-release-5-2-122/openpgm/pgm/configure.ac 2023-01-03 16:07:39.751560631 +0100 +@@ -62,7 +62,7 @@ + + # Checks for header files. + AC_FUNC_ALLOCA +-AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.h]) ++AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h grp.h inttypes.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_HEADER_STDBOOL +diff -ur openpgm-release-5-2-122.orig/openpgm/pgm/engine.c openpgm-release-5-2-122/openpgm/pgm/engine.c +--- openpgm-release-5-2-122.orig/openpgm/pgm/engine.c 2023-01-03 16:03:16.834181524 +0100 ++++ openpgm-release-5-2-122/openpgm/pgm/engine.c 2023-01-03 16:08:05.458304376 +0100 +@@ -31,6 +31,10 @@ + # include + #endif + ++#ifdef HAVE_GRP_H ++# include ++#endif ++ + #ifndef _BSD_SOURCE + # define _BSD_SOURCE 1 /* getprotobyname_r */ + #endif diff --git a/openpgm-configure-c99.patch b/openpgm-configure-c99.patch new file mode 100644 index 0000000..cf8a644 --- /dev/null +++ b/openpgm-configure-c99.patch @@ -0,0 +1,18 @@ +Include for the printf function. This avoids an implicit +function declaration in this configure check, causing to fail +unconditionally with compilers that do not support them. + +Submitted upstream: + +diff -ur openpgm-release-5-2-122.orig/openpgm/pgm/configure.ac openpgm-release-5-2-122/openpgm/pgm/configure.ac +--- openpgm-release-5-2-122.orig/openpgm/pgm/configure.ac 2012-12-04 03:56:54.000000000 +0100 ++++ openpgm-release-5-2-122/openpgm/pgm/configure.ac 2023-01-03 16:07:39.751560631 +0100 +@@ -207,7 +207,7 @@ + # sprintf, caveat http://savannah.gnu.org/patch/?6848 (ax_c_printf_thsep) + AC_MSG_CHECKING([for printf thousands' grouping]) + AC_COMPILE_IFELSE( +- [AC_LANG_PROGRAM(,[[printf ("%'d", 1000000);]])], ++ [AC_LANG_PROGRAM([[#include ]],[[printf ("%'d", 1000000);]])], + [AC_MSG_RESULT([yes]) + CFLAGS="$CFLAGS -DHAVE_SPRINTF_GROUPING"], + [AC_MSG_RESULT([no])]) diff --git a/openpgm.spec b/openpgm.spec index 72067ef..02ece2b 100644 --- a/openpgm.spec +++ b/openpgm.spec @@ -20,6 +20,8 @@ Patch2: openpgm-02-c-func.patch Patch3: openpgm-03-pkgconfig.patch Patch4: openpgm-04-py-version-gen.patch Patch5: openpgm-05-fix-setgid.patch +Patch6: openpgm-configure-c99.patch +Patch7: openpgm-c99.patch BuildRequires: make BuildRequires: libtool automake autoconf @@ -48,6 +50,8 @@ This package contains OpenPGM related development libraries and header files. %patch3 -p3 %patch4 -p3 %patch5 -p3 +%patch6 -p3 +%patch7 -p3 dos2unix examples/getopt.c examples/getopt.h %build