Hi autoconf team.

During testing of tcc 0.9.28rc,
I found a strange bug in autoconf 2.71 with `AC_CHECK_DEFINE` for `__unix__`.
For comparsion, i added checks for "__unix" and "__linux__":

Overview:
* [__unix__] always found, but the log text is crippled
*  __unix__  never found and the log text is crippled
* The second check does not use the cached result from the first check

* When i duplicate the tests, the duplicate test used the cached result
  from the previous check, but all other failures remain.
  (1: first result: see above, 2: cached result from 1,
   3: different result: see above, 4: cached result from 3)


I am using tcc 0.9.28rc on linux
and gcc 12.3.0 produces the same results.


Please test this snipped with the current 2.72rc:
```
AC_CHECK_DEFINE(__unix, CFLAGS="-DFOUND__unix $CFLAGS")
AC_CHECK_DEFINE(__unix__, CFLAGS="-DFOUND__unix__ $CFLAGS")
AC_CHECK_DEFINE(__linux__, CFLAGS="-DFOUND__linux__ $CFLAGS")

AC_CHECK_DEFINE([__unix], CFLAGS="-DFOUNDxx__unix $CFLAGS")
AC_CHECK_DEFINE([__unix__], CFLAGS="-DFOUNDxx__unix__ $CFLAGS")
AC_CHECK_DEFINE([__linux__], CFLAGS="-DFOUNDxx__linux__ $CFLAGS")
```

buggy results:
```
checking for __unix defined... yes
checking for  defined... no
checking for __linux__ defined... yes
checking for __unix defined... (cached) yes
checking for  defined... yes
checking for __linux__ defined... (cached) yes
```


And yes, when the checks are reordered, ....
```
AC_CHECK_DEFINE([__unix], CFLAGS="-DFOUNDxx__unix $CFLAGS")
AC_CHECK_DEFINE([__unix__], CFLAGS="-DFOUNDxx__unix__ $CFLAGS")
AC_CHECK_DEFINE([__linux__], CFLAGS="-DFOUNDxx__linux__ $CFLAGS")

AC_CHECK_DEFINE(__unix, CFLAGS="-DFOUND__unix $CFLAGS")
AC_CHECK_DEFINE(__unix__, CFLAGS="-DFOUND__unix__ $CFLAGS")
AC_CHECK_DEFINE(__linux__, CFLAGS="-DFOUND__linux__ $CFLAGS")
```

... the results are different:

```
checking for __unix defined... yes
checking for  defined... yes
checking for __linux__ defined... yes
checking for __unix defined... (cached) yes
checking for  defined... no
checking for __linux__ defined... (cached) yes
```

* What is 2.72rc doing?
* Should i add a bug report for 2.71 to document this bug?


--
Bye bye ... Detlef


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

Reply via email to