From 78dcbc8cd9011d17507454cecae91ed24db454d2 Mon Sep 17 00:00:00 2001 From: Marcus Sundberg Date: Sat, 8 Jan 2000 18:02:29 +0000 Subject: [PATCH] This contains additional autoconf macros. Currently just AC_HAVE_STRUCT_FIELD() --- acinclude.m4 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 acinclude.m4 diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..db8b82f --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,17 @@ +dnl check for fields in a structure +dnl +dnl AC_HAVE_STRUCT_FIELD(struct, field, headers) + +AC_DEFUN(AC_HAVE_STRUCT_FIELD, [ +define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_])) +AC_CACHE_CHECK([for $2 in $1], cache_val,[ +AC_TRY_COMPILE([$3],[$1 x; x.$2;], +cache_val=yes, +cache_val=no)]) +if test "$cache_val" = yes; then + define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_])) + AC_DEFINE(foo, 1, [Define if $1 has field $2.]) + undefine(foo) +fi +undefine(cache_val) +])