munge: fix build on macOS < 10.11

- fix implicit function declarations

Closes: https://trac.macports.org/ticket/73495
Closes: https://trac.macports.org/ticket/72916
Closes: https://trac.macports.org/ticket/73728
This commit is contained in:
commitmaniac
2026-04-17 09:25:31 -04:00
committed by GitHub
parent 0c4bdd0fb0
commit 3f00f9ecf3
2 changed files with 166 additions and 0 deletions
+12
View File
@@ -3,6 +3,7 @@
PortSystem 1.0
PortGroup github 1.0
PortGroup openssl 1.0
PortGroup legacysupport 1.1
github.setup dun munge 0.5.18 munge-
revision 0
@@ -36,8 +37,19 @@ depends_lib port:bzip2 \
use_autoreconf yes
# Regenerating configure to patch implict functions
# Fixed upstream, remove when newer version is available
patchfiles implicit.patch
# getentropy, clock_gettime
legacysupport.newest_darwin_requires_legacy 15
configure.args --disable-silent-rules
# alignof is only available in C23, which is not needed
# See: https://trac.macports.org/wiki/WimplicitFunctionDeclaration
configure.checks.implicit_function_declaration.whitelist-append strchr alignof
# We can either use OpenSSL or libgcrypt. Let's default to OpenSSL.
variant openssl conflicts libgcrypt description {Use openssl for cryptographic routines} {
openssl.branch 3
+154
View File
@@ -0,0 +1,154 @@
Fix implicit functions for EVP_CIPHER_CTX_cleanup and getgrent_r
From: https://github.com/dun/munge/commit/ede8c9b613f5fce0bedea4f9e71924f4920b9edf
From: https://github.com/dun/munge/commit/deb85536441ab28733e4d8f8a76e5a725afe8ecd
From: https://github.com/dun/munge/commit/9317fe8a7efe692d8c5547c3b5c83dacb2c26872
--- m4/x_ac_check_openssl.m4.orig 2026-02-10 03:07:53.000000000 -0500
+++ m4/x_ac_check_openssl.m4 2026-04-12 19:55:34.982749017 -0400
@@ -124,28 +124,34 @@
# and the <INCLUDES> are the prologue of the test source to be linked.
# The AC_LANG_PROGRAM #undef in the preamble is needed to thwart #define
# macros used for backwards-compatibility of deprecated functions.
+# This check only runs if AC_CHECK_FUNCS has determined the function exists
+# (i.e., ac_cv_func_<NAME> = yes), preventing implicit function declaration
+# warnings when testing non-existent functions.
#
AC_DEFUN([_X_AC_CHECK_OPENSSL_FUNC_RETURNS_INT], [
- AC_CACHE_CHECK(
- [if $1 returns int],
- [ac_cv_func_$1_returns_int], [
- AS_VAR_SET([ac_cv_func_$1_returns_int], no)
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM(
- [[
+ AS_IF(
+ [test "AS_VAR_GET([ac_cv_func_$1])" = yes], [
+ AC_CACHE_CHECK(
+ [if $1 returns int],
+ [ac_cv_func_$1_returns_int], [
+ AS_VAR_SET([ac_cv_func_$1_returns_int], no)
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM(
+ [[
$3
#undef $1
]],
- [[int rv = $1 ($2);]]
- )],
- AS_VAR_SET([ac_cv_func_$1_returns_int], yes),
- AS_VAR_SET([ac_cv_func_$1_returns_int], no)
- )]
- )
- AS_IF(
- [test AS_VAR_GET([ac_cv_func_$1_returns_int]) = yes],
- AC_DEFINE(AS_TR_CPP([HAVE_$1_RETURN_INT]), [1],
- [Define to 1 if the `$1' function returns int.]
+ [[int rv = $1 ($2);]]
+ )],
+ AS_VAR_SET([ac_cv_func_$1_returns_int], yes),
+ AS_VAR_SET([ac_cv_func_$1_returns_int], no)
+ )]
)
+ AS_IF(
+ [test AS_VAR_GET([ac_cv_func_$1_returns_int]) = yes],
+ AC_DEFINE(AS_TR_CPP([HAVE_$1_RETURN_INT]), [1],
+ [Define to 1 if the `$1' function returns int.]
+ )
+ )]
)]
)
--- m4/x_ac_getgrent.m4.orig 2026-02-10 03:07:53.000000000 -0500
+++ m4/x_ac_getgrent.m4 2026-04-12 19:57:35.898190342 -0400
@@ -18,17 +18,41 @@
AC_DEFUN([X_AC_GETGRENT], [
AC_CHECK_FUNCS(getgrent)
+ _X_AC_GETGRENT_CHECK_WNO_IMPLICIT
+ _x_ac_getgrent_cflags_save="${CFLAGS}"
+ _x_ac_getgrent_werror_save="${ac_c_werror_flag}"
+ CFLAGS="${CFLAGS} ${x_ac_getgrent_wno_implicit_flag}"
+ ac_c_werror_flag=yes
_X_AC_GETGRENT_R_AIX
_X_AC_GETGRENT_R_GNU
_X_AC_GETGRENT_R_SUN
+ CFLAGS="${_x_ac_getgrent_cflags_save}"
+ ac_c_werror_flag="${_x_ac_getgrent_werror_save}"
])
+AC_DEFUN([_X_AC_GETGRENT_CHECK_WNO_IMPLICIT], [
+ AC_MSG_CHECKING([if ${CC} supports -Wno-implicit-function-declaration])
+ _x_ac_getgrent_check_cflags_save="${CFLAGS}"
+ CFLAGS="${CFLAGS} -Wno-implicit-function-declaration -Werror"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM()],
+ [ x_ac_getgrent_have_wno_implicit=yes
+ x_ac_getgrent_wno_implicit_flag="-Wno-implicit-function-declaration" ],
+ [ x_ac_getgrent_have_wno_implicit=no
+ x_ac_getgrent_wno_implicit_flag="" ]
+ )
+ CFLAGS="${_x_ac_getgrent_check_cflags_save}"
+ AS_IF(
+ [test "x${x_ac_getgrent_have_wno_implicit}" = xyes],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])]
+ )]
+)
+
AC_DEFUN([_X_AC_GETGRENT_R_AIX], [
AC_CACHE_CHECK(
[for getgrent_r (AIX)],
[x_ac_cv_have_getgrent_r_aix], [
- _x_ac_getgrent_r_aix_c_werror_flag="$ac_c_werror_flag"
- ac_c_werror_flag=yes
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#define _THREAD_SAFE 1
@@ -44,8 +68,7 @@
)],
AS_VAR_SET(x_ac_cv_have_getgrent_r_aix, yes),
AS_VAR_SET(x_ac_cv_have_getgrent_r_aix, no)
- )
- ac_c_werror_flag="$_x_ac_getgrent_r_aix_c_werror_flag"]
+ )]
)
AS_IF([test AS_VAR_GET(x_ac_cv_have_getgrent_r_aix) = yes],
AC_DEFINE([HAVE_GETGRENT_R_AIX], [1],
@@ -58,8 +81,6 @@
AC_CACHE_CHECK(
[for getgrent_r (GNU)],
[x_ac_cv_have_getgrent_r_gnu], [
- _x_ac_getgrent_r_gnu_c_werror_flag="$ac_c_werror_flag"
- ac_c_werror_flag=yes
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#define _GNU_SOURCE 1
@@ -73,8 +94,7 @@
)],
AS_VAR_SET(x_ac_cv_have_getgrent_r_gnu, yes),
AS_VAR_SET(x_ac_cv_have_getgrent_r_gnu, no)
- )
- ac_c_werror_flag="$_x_ac_getgrent_r_gnu_c_werror_flag"]
+ )]
)
AS_IF([test AS_VAR_GET(x_ac_cv_have_getgrent_r_gnu) = yes],
AC_DEFINE([HAVE_GETGRENT_R_GNU], [1],
@@ -87,8 +107,6 @@
AC_CACHE_CHECK(
[for getgrent_r (SunOS)],
[x_ac_cv_have_getgrent_r_sun], [
- _x_ac_getgrent_r_sun_c_werror_flag="$ac_c_werror_flag"
- ac_c_werror_flag=yes
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <grp.h>
@@ -100,8 +118,7 @@
)],
AS_VAR_SET(x_ac_cv_have_getgrent_r_sun, yes),
AS_VAR_SET(x_ac_cv_have_getgrent_r_sun, no)
- )
- ac_c_werror_flag="$_x_ac_getgrent_r_sun_c_werror_flag"]
+ )]
)
AS_IF([test AS_VAR_GET(x_ac_cv_have_getgrent_r_sun) = yes],
AC_DEFINE([HAVE_GETGRENT_R_SUN], [1],