Skip to content

Commit b9454c0

Browse files
committed
Fix compilation if sys/sysctl.h is not present
Glibc 2.32 removes sys/sysctl.h as it is no longer needed. This commit fixes the compilation with newer versions of Glibc by checking for sys/sysctl.h with has_include, which in turn is only used if it is supported. This should mean that this commit does not prevent any configuration that worked before from working.
1 parent 20dde1a commit b9454c0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libavutil/cpu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@
3939
#include <sys/param.h>
4040
#endif
4141
#include <sys/types.h>
42+
43+
44+
#if __cplusplus >= 201703L
45+
#if __has_include(<sys/sysctl.h>)
4246
#include <sys/sysctl.h>
4347
#endif
48+
#else
49+
#include <sys/sysctl.h>
50+
#endif
51+
#endif
4452
#if HAVE_UNISTD_H
4553
#include <unistd.h>
4654
#endif

0 commit comments

Comments
 (0)