On 2023-09-23, Nick Bowler <nbow...@draconx.ca> wrote:
> On 2023-09-23, Detlef Riekenberg <wine....@web.de> wrote:
>> AC_CHECK_DEFINE(__unix, CFLAGS="-DFOUND__unix $CFLAGS")
>> AC_CHECK_DEFINE(__unix__, CFLAGS="-DFOUND__unix__ $CFLAGS")
>> AC_CHECK_DEFINE(__linux__, CFLAGS="-DFOUND__linux__ $CFLAGS")
[...]
> So it sounds like there must be some third party code involved which
> is defining this macro (and this code is defining macros in the AC_*
> namespace to make it look like it came from Autoconf when in fact it
> did not).

Just to add, you don't need any third party macros to check for typical
C predefined macros including __unix, etc.  I would write such checks
something like this (untested):

  AC_COMPUTE_INT([unix_val], [__unix], [@&t@], [unix_val=0])
  AS_IF([test $unix_val -ne 0],
    [put code here to run when __unix is defined and is non-zero])

That works out of the box with Autoconf and should be a very robust
check.  The third argument to AC_COMPUTE_INT is @&t@ to prevent
Autoconf from inserting the default #includes in the test program.

If you need to distinguish the case where __unix may be pre-defined
with the value 0 (probably not relevant with this particular macro),
then you can tweak the action-if-failed (fourth argument) and if
condition a bit.

Hope that helps,
  Nick

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to