Skip to content

Commit

Permalink
Fix compilation if sys/sysctl.h is not present
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrsnen committed Jun 15, 2023
1 parent 20dde1a commit 74418d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libavutil/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
#include <sys/param.h>
#endif
#include <sys/types.h>

#if __cplusplus >= 201703L
#if __has_include(<sys/sysctl.h>)
#include <sys/sysctl.h>
#endif
#endif

#endif
#if HAVE_UNISTD_H
#include <unistd.h>
Expand Down

0 comments on commit 74418d3

Please sign in to comment.