[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/12] use a shell function for AC_CHECK_MEMBER
From: |
Eric Blake |
Subject: |
Re: [PATCH 11/12] use a shell function for AC_CHECK_MEMBER |
Date: |
Mon, 27 Oct 2008 15:04:54 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Paolo Bonzini <bonzini <at> gnu.org> writes:
>
> While passing the variable name simplified the shell function a little,
> I decided anyway not to drop the AS_VAR_* usage from AC_CHECK_MEMBER,
> because it simplifies passing the variable name to the function.
Another fun one that needs more discussion.
> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]5],
> +[static $[]2 ac_aggr;
> +if (ac_aggr.$[]3)
> +return 0;])],
> + [AS_VAR_SET([$[]4], [yes])],
> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]5],
> +[static $[]2 ac_aggr;
> +if (sizeof ac_aggr.$[]3)
> +return 0;])],
Another case of double effort in building the test program, where a strategic
addition to CFLAGS could allow a single source file across the two compile
tests.
> AC_DEFUN([AC_CHECK_MEMBER],
> +[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_member],
> + [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_member],
> + [LINENO AGGR MEMBER VAR INCLUDES],
> + [Tries to find the field MEMBER exists in type AGGR, after including
s/find the/find if the/
> + INCLUDES, setting cache variable VAR accordingly.])],
> + [_$0_BODY])]dnl
> +[AS_LITERAL_IF([$1], [], [AC_FATAL([$0: requires literal arguments])])]dnl
Pre-existing, but worth fixing: AC_FATAL is an obsolete synonym for m4_fatal,...
> +[m4_bmatch([$1], [\.], , [m4_fatal([$0: Did not see any dot in `$1'])])]dnl
so we might as well use m4_fatal twice for consistency. m4_bmatch is overkill
for finding a single literal character (m4_index is much faster). I guess I
should clean this up in advance, then we can rebase this patch.
> +[AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])]dnl
> +[ac_func_[]_AC_LANG_ABBREV[]_check_member "$LINENO" ]dnl
> +["m4_bpatsubst([$1], [\..*])" "m4_bpatsubst([$1], [^[^.]*\.])" "ac_Member" ]
dnl
Two m4_bpatsubst? Let's be more efficient with m4 processing power, since m4
regex is expensive:
"m4_bpatsubst([$1], [\.\(.*\)], [" "\1])" "ac_Member"
> +["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4], ["])])"
Font-lock.
--
Eric Blake