Skip to content

allow more flexible condition evaluation #35

@comicfans

Description

@comicfans

rules_cc_autoconf it's quite useful for bazel porting, I'm trying to base my meson header generation function on rules_cc_autoconf (https://github.com/comicfans/rules_cc_autoconf/tree/meson).

currently checks.AC_ macro supports condition to get 'and' behavior , this makes condition construction complex even for simple bool logic, for example

if HAVE_SYS_XATTR_H or HAVE_ATTR_XATTR_H:
   define HAVE_XATTR

then I have to write something like

checks.AC_CHECK_HEADER('sys/xattr.h', define = "HAVE_SYS_XATTR_H"),
checks.AC_CHECK_HEADER('attr/xattr.h', define = "HAVE_ATTR_XATTR_H"),
checks.AC_DEFINE("NO_SYS_XATTR_H", requires = ["!HAVE_SYS_XATTR_H"]),
checks.AC_DEFINE("NO_ATTR_XATTR_H", requires= ["!HAVE_ATTR_XATTR_H"]),
checks.AC_DEFINE("NO_BOTH", requires = ["NO_SYS_XATTR_H", "NO_ATTR_XATTR_H"]),
checks.AC_DEFINE("HAVE_XATTR", requires = ["!NOT_BOTH"])

it might also lead unexpected define.

I wonder if we can support arbitrary expression evaluation, for example a python helper , inject all checks as variable, then complex condition expression can be used ease the bazel port

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions