1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42:48 -05:00

Fix build failure on Intel Macs.

sysctlbyname() turns out to be a new library function, so we can't
assume it's present just because defined __APPLE__. Add an autoconf
check to see if it's really there, before trying to call it.
This commit is contained in:
Simon Tatham
2020-12-24 20:45:28 +00:00
parent 31cd5ee19b
commit d594df9803
2 changed files with 5 additions and 1 deletions

View File

@ -49,10 +49,14 @@ static inline u_long getauxval(int which) { return 0; }
#if defined __APPLE__
static inline bool test_sysctl_flag(const char *flagname)
{
#ifdef HAVE_SYSCTLBYNAME
int value;
size_t size = sizeof(value);
return (sysctlbyname(flagname, &value, &size, NULL, 0) == 0 &&
size == sizeof(value) && value != 0);
#else /* HAVE_SYSCTLBYNAME */
return false;
#endif /* HAVE_SYSCTLBYNAME */
}
#endif /* defined __APPLE__ */