| 1 |
From: Florian Weimer <[email protected]> |
| 2 |
Date: Thu, 13 Apr 2023 13:13:59 +0200 |
| 3 |
Subject: cf: Include <string.h> for memset in AC_HAVE_STRUCT_FIELD |
| 4 |
|
| 5 |
Otherwise, the check relies on an implicit function declaration, |
| 6 |
and will fail unconditionally with compilers that do not support |
| 7 |
them. |
| 8 |
--- |
| 9 |
cf/have-struct-field.m4 | 3 ++- |
| 10 |
1 file changed, 2 insertions(+), 1 deletion(-) |
| 11 |
|
| 12 |
diff --git a/cf/have-struct-field.m4 b/cf/have-struct-field.m4 |
| 13 |
index bb7bcef..3962d85 100644 |
| 14 |
--- a/cf/have-struct-field.m4 |
| 15 |
+++ b/cf/have-struct-field.m4 |
| 16 |
@@ -7,7 +7,8 @@ dnl AC_HAVE_STRUCT_FIELD(struct, field, headers) |
| 17 |
AC_DEFUN([AC_HAVE_STRUCT_FIELD], [ |
| 18 |
define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_])) |
| 19 |
AC_CACHE_CHECK([for $2 in $1], cache_val,[ |
| 20 |
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]], |
| 21 |
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h> |
| 22 |
+$3]], |
| 23 |
[[$1 x; memset(&x, 0, sizeof(x)); x.$2]])], |
| 24 |
[cache_val=yes], |
| 25 |
[cache_val=no]) |