diff options
| author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-10 11:43:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-10 11:43:20 +0100 |
| commit | c07206f2ccc2356aa74bc6813a94c2190017d44e (patch) | |
| tree | 1677e5fdca5c3ce544e92c5484e16a0b68df1cc9 /gl/m4/vararrays.m4 | |
| parent | e92046f810658016b7c373677efefda3b21400e4 (diff) | |
| parent | d2fcf49ad4afc15f37d082d7bc96a808369ec2d4 (diff) | |
| download | monitoring-plugins-c07206f2ccc2356aa74bc6813a94c2190017d44e.tar.gz | |
Merge pull request #1832 from RincewindsHat/gnulib_update_2023
Gnulib update 2023 and attendant fixes
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 00000000..fd6230c2 --- /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 | ]) | ||
