*** empty log message ***
[findutils.git] / m4 / const.m4
blobebe59596c8de4c95fc5a314ed0d71a4784777466
1 #serial 1
3 dnl Just like AC_C_CONST from autoconf-2.12, but with an initializer
4 dnl for `charset x' and with
5 dnl   AC_DEFINE(const, )
6 dnl changed to
7 dnl   AC_DEFINE_UNQUOTED(const, [/* empty */])
8 dnl to avoid this warning:
9 dnl   [...]/m4: Warning: Excess arguments to built-in `define' ignored
11 undefine([AC_C_CONST])
12 AC_DEFUN(AC_C_CONST,
13 [dnl This message is consistent in form with the other checking messages,
14 dnl and with the result message.
15 AC_CACHE_CHECK([for working const], ac_cv_c_const,
16 [AC_TRY_COMPILE(,
17 changequote(<<, >>)dnl
19 /* Ultrix mips cc rejects this.  */
20 typedef int charset[2]; const charset x = {0, 0};
21 /* SunOS 4.1.1 cc rejects this.  */
22 char const *const *ccp;
23 char **p;
24 /* NEC SVR4.0.2 mips cc rejects this.  */
25 struct point {int x, y;};
26 static struct point const zero = {0,0};
27 /* AIX XL C 1.02.0.0 rejects this.
28    It does not let you subtract one const X* pointer from another in an arm
29    of an if-expression whose if-part is not a constant expression */
30 const char *g = "string";
31 ccp = &g + (g ? g-g : 0);
32 /* HPUX 7.0 cc rejects these. */
33 ++ccp;
34 p = (char**) ccp;
35 ccp = (char const *const *) p;
36 { /* SCO 3.2v4 cc rejects this.  */
37   char *t;
38   char const *s = 0 ? (char *) 0 : (char const *) 0;
40   *t++ = 0;
42 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
43   int x[] = {25, 17};
44   const int *foo = &x[0];
45   ++foo;
47 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
48   typedef const int *iptr;
49   iptr p = 0;
50   ++p;
52 { /* AIX XL C 1.02.0.0 rejects this saying
53      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
54   struct s { int j; const int *ap[3]; };
55   struct s *b; b->j = 5;
57 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
58   const int foo = 10;
60 >>,
61 changequote([, ])dnl
62 ac_cv_c_const=yes, ac_cv_c_const=no)])
63 if test $ac_cv_c_const = no; then
64   AC_DEFINE_UNQUOTED(const, [/* empty */])