diff options
author | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-19 22:49:18 (GMT) |
---|---|---|
committer | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-19 22:49:18 (GMT) |
commit | a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7 (patch) | |
tree | 8effe94c57b2f9796ba36090b07551baa8f1e1cb /gl/m4/builtin-expect.m4 | |
parent | ca3d59cd6918c9e2739e783b721d4c1122640fd3 (diff) | |
parent | c07206f2ccc2356aa74bc6813a94c2190017d44e (diff) | |
download | monitoring-plugins-a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7.tar.gz |
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option
Diffstat (limited to 'gl/m4/builtin-expect.m4')
-rw-r--r-- | gl/m4/builtin-expect.m4 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4 new file mode 100644 index 0000000..531ed48 --- /dev/null +++ b/gl/m4/builtin-expect.m4 | |||
@@ -0,0 +1,49 @@ | |||
1 | dnl Check for __builtin_expect. | ||
2 | |||
3 | dnl Copyright 2016-2023 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | dnl Written by Paul Eggert. | ||
9 | |||
10 | AC_DEFUN([gl___BUILTIN_EXPECT], | ||
11 | [ | ||
12 | AC_CACHE_CHECK([for __builtin_expect], | ||
13 | [gl_cv___builtin_expect], | ||
14 | [AC_LINK_IFELSE( | ||
15 | [AC_LANG_SOURCE([[ | ||
16 | int | ||
17 | main (int argc, char **argv) | ||
18 | { | ||
19 | argc = __builtin_expect (argc, 100); | ||
20 | return argv[argc != 100][0]; | ||
21 | }]])], | ||
22 | [gl_cv___builtin_expect=yes], | ||
23 | [AC_LINK_IFELSE( | ||
24 | [AC_LANG_SOURCE([[ | ||
25 | #include <builtins.h> | ||
26 | int | ||
27 | main (int argc, char **argv) | ||
28 | { | ||
29 | argc = __builtin_expect (argc, 100); | ||
30 | return argv[argc != 100][0]; | ||
31 | }]])], | ||
32 | [gl_cv___builtin_expect="in <builtins.h>"], | ||
33 | [gl_cv___builtin_expect=no])])]) | ||
34 | if test "$gl_cv___builtin_expect" = yes; then | ||
35 | AC_DEFINE([HAVE___BUILTIN_EXPECT], [1]) | ||
36 | elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then | ||
37 | AC_DEFINE([HAVE___BUILTIN_EXPECT], [2]) | ||
38 | fi | ||
39 | AH_VERBATIM([HAVE___BUILTIN_EXPECT], | ||
40 | [/* Define to 1 if the compiler supports __builtin_expect, | ||
41 | and to 2 if <builtins.h> does. */ | ||
42 | #undef HAVE___BUILTIN_EXPECT | ||
43 | #ifndef HAVE___BUILTIN_EXPECT | ||
44 | # define __builtin_expect(e, c) (e) | ||
45 | #elif HAVE___BUILTIN_EXPECT == 2 | ||
46 | # include <builtins.h> | ||
47 | #endif | ||
48 | ]) | ||
49 | ]) | ||