Issue with AC_TYPE_PID_T when using winpthreads with MSVC

Kirill Makurin <[email protected]> Mon, 29 Dec 2025 13:35:24 +0000
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <LV5PR05MB998298E4CE7AA2205925EAD7B8B1BFA@LV5PR05MB998298.namprd05.prod.outlook.com>
Hello,

In winpthreads's pthread_compat.h[1] we have the following code, which is only used when it is included with MSVC:

```
#ifdef _WIN64
typedef __int64 pid_t;
#else
typedef int     pid_t;
#endif
```

If project's configure.ac invokes AC_TYPE_PID_T, since MSVC's header file do not declare pid_t, the check will fail and it will add

```
#define pid_t int
// or
#define pid_t __int64
```

to generated config.h. Later, if both config.h and pthread_compat.h are included, this will result in compilation error since above code, after preprocessing, becomes

```
typedef int int;
// or
typedef __int64 __int64;
```

Can AC_TYPE_PID_T be changed to use `typedef` instead of `#define` to provide definition of `pid_t`? If this is not feasible, we will resort to either undefining `pid_t` or guarding the winpthreads's typedefs.

- Kirill Makurin

[1] https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-libraries/winpthreads/include/pthread_compat.h