diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-18 20:59:46 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-18 20:59:46 (GMT) |
commit | 0e70e81133c25274fe2dd2309556b41357dd759b (patch) | |
tree | 9a680b36788ee1ad4e7ecc5ccfeb4494db9fdc72 /gl/m4/vararrays.m4 | |
parent | ce355c80cf6054bfa5e1dcf81f9e2183ef963ee1 (diff) | |
parent | 2ddc75e69db5a3dd379c896d8420c9af20ec1cee (diff) | |
download | monitoring-plugins-0e70e81133c25274fe2dd2309556b41357dd759b.tar.gz |
Merge branch 'master' into mysql_detect_mysqldumprefs/pull/1718/head
Diffstat (limited to 'gl/m4/vararrays.m4')
-rw-r--r-- | gl/m4/vararrays.m4 | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4 new file mode 100644 index 0000000..fd6230c --- /dev/null +++ b/gl/m4/vararrays.m4 | |||
@@ -0,0 +1,72 @@ | |||
1 | # Check for variable-length arrays. | ||
2 | |||
3 | # serial 6 | ||
4 | |||
5 | # From Paul Eggert | ||
6 | |||
7 | # Copyright (C) 2001, 2009-2023 Free Software Foundation, Inc. | ||
8 | # This file is free software; the Free Software Foundation | ||
9 | # gives unlimited permission to copy and/or distribute it, | ||
10 | # with or without modifications, as long as this notice is preserved. | ||
11 | |||
12 | m4_version_prereq([2.70], [], [ | ||
13 | |||
14 | # AC_C_VARARRAYS | ||
15 | # -------------- | ||
16 | # Check whether the C compiler supports variable-length arrays. | ||
17 | AC_DEFUN([AC_C_VARARRAYS], | ||
18 | [ | ||
19 | AC_CACHE_CHECK([for variable-length arrays], | ||
20 | ac_cv_c_vararrays, | ||
21 | [AC_EGREP_CPP([defined], | ||
22 | [#ifdef __STDC_NO_VLA__ | ||
23 | defined | ||
24 | #endif | ||
25 | ], | ||
26 | [ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'], | ||
27 | [AC_COMPILE_IFELSE( | ||
28 | [AC_LANG_PROGRAM( | ||
29 | [[/* Test for VLA support. This test is partly inspired | ||
30 | from examples in the C standard. Use at least two VLA | ||
31 | functions to detect the GCC 3.4.3 bug described in: | ||
32 | https://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00014.html | ||
33 | */ | ||
34 | #ifdef __STDC_NO_VLA__ | ||
35 | syntax error; | ||
36 | #else | ||
37 | extern int n; | ||
38 | int B[100]; | ||
39 | int fvla (int m, int C[m][m]); | ||
40 | |||
41 | int | ||
42 | simple (int count, int all[static count]) | ||
43 | { | ||
44 | return all[count - 1]; | ||
45 | } | ||
46 | |||
47 | int | ||
48 | fvla (int m, int C[m][m]) | ||
49 | { | ||
50 | typedef int VLA[m][m]; | ||
51 | VLA x; | ||
52 | int D[m]; | ||
53 | static int (*q)[m] = &B; | ||
54 | int (*s)[n] = q; | ||
55 | return C && &x[0][0] == &D[0] && &D[0] == s[0]; | ||
56 | } | ||
57 | #endif | ||
58 | ]])], | ||
59 | [ac_cv_c_vararrays=yes], | ||
60 | [ac_cv_c_vararrays=no])])]) | ||
61 | if test "$ac_cv_c_vararrays" = yes; then | ||
62 | dnl This is for compatibility with Autoconf 2.61-2.69. | ||
63 | AC_DEFINE([HAVE_C_VARARRAYS], 1, | ||
64 | [Define to 1 if C supports variable-length arrays.]) | ||
65 | elif test "$ac_cv_c_vararrays" = no; then | ||
66 | AC_DEFINE([__STDC_NO_VLA__], 1, | ||
67 | [Define to 1 if C does not support variable-length arrays, and | ||
68 | if the compiler does not already define this.]) | ||
69 | fi | ||
70 | ]) | ||
71 | |||
72 | ]) | ||