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 19, 2023
1 parent 20dde1a commit b9454c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libavutil/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@
#include <sys/param.h>
#endif
#include <sys/types.h>


#if __cplusplus >= 201703L
#if __has_include(<sys/sysctl.h>)
#include <sys/sysctl.h>
#endif
#else
#include <sys/sysctl.h>
#endif
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
Expand Down

0 comments on commit b9454c0

Please sign in to comment.