3 dnl Just like AC_C_CONST from autoconf-2.12, but with an initializer
4 dnl for `charset x' and with
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])
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,
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;
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. */
35 ccp = (char const *const *) p;
36 { /* SCO 3.2v4 cc rejects this. */
38 char const *s = 0 ? (char *) 0 : (char const *) 0;
42 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
44 const int *foo = &x[0];
47 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
48 typedef const int *iptr;
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 */
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 */])