]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Wed Mar 20 09:37:31 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
authorRoland McGrath <roland@gnu.org>
Wed, 20 Mar 1996 19:18:39 +0000 (19:18 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 20 Mar 1996 19:18:39 +0000 (19:18 +0000)
* acspecific.m4 (AC_C_CONST): Add check for gcc 2.7 bug.
From Paul Eggert and Jim Meyering.

acspecific.m4
lib/autoconf/specific.m4

index 6f29ee70fa614b016f1b67ca74af49a801448989..a1107d9693d68f38b35a04f8408c74f9d1bd2868 100644 (file)
@@ -1553,7 +1553,40 @@ ccp = (char const *const *) p;
 }
 >>,
 changequote([, ])dnl
-ac_cv_c_const=yes, ac_cv_c_const=no)])
+ac_cv_c_const=yes, ac_cv_c_const=no)
+dnl
+dnl If the above compile succeeds, there may still be a problem.
+dnl At least one compiler, gcc-2.7.x, generates bad code for the following
+dnl program.  If not cross-compiling then compile, link, and run the
+dnl following program to detect this.  Otherwise, resort to using cpp
+dnl to check gcc's preprocessor symbols.
+dnl
+if test $ac_cv_c_const = yes; then
+  AC_TRY_RUN(dnl
+    [dnl
+      /* Thanks to Paul Eggert for this test.  */
+      static void set (p) char *p; {*p = 'x';}
+      int
+      main ()
+      {
+       int i;
+       for (i = 0; i < 1; ++i)
+         {
+           char x;
+           set (&x);
+           if (*(const char *) &x != 'x')
+             exit (1);
+         }
+       exit (0);
+      }
+    ], , ac_cv_c_const=no,
+      AC_EGREP_CPP(syntax-error,
+        [#if __GNUC__ == 2 && __GNUC_MINOR__ == 7
+         syntax-error
+#endif
+       ], ac_cv_c_const=no))
+fi
+])
 if test $ac_cv_c_const = no; then
   AC_DEFINE(const, )
 fi
index 6f29ee70fa614b016f1b67ca74af49a801448989..a1107d9693d68f38b35a04f8408c74f9d1bd2868 100644 (file)
@@ -1553,7 +1553,40 @@ ccp = (char const *const *) p;
 }
 >>,
 changequote([, ])dnl
-ac_cv_c_const=yes, ac_cv_c_const=no)])
+ac_cv_c_const=yes, ac_cv_c_const=no)
+dnl
+dnl If the above compile succeeds, there may still be a problem.
+dnl At least one compiler, gcc-2.7.x, generates bad code for the following
+dnl program.  If not cross-compiling then compile, link, and run the
+dnl following program to detect this.  Otherwise, resort to using cpp
+dnl to check gcc's preprocessor symbols.
+dnl
+if test $ac_cv_c_const = yes; then
+  AC_TRY_RUN(dnl
+    [dnl
+      /* Thanks to Paul Eggert for this test.  */
+      static void set (p) char *p; {*p = 'x';}
+      int
+      main ()
+      {
+       int i;
+       for (i = 0; i < 1; ++i)
+         {
+           char x;
+           set (&x);
+           if (*(const char *) &x != 'x')
+             exit (1);
+         }
+       exit (0);
+      }
+    ], , ac_cv_c_const=no,
+      AC_EGREP_CPP(syntax-error,
+        [#if __GNUC__ == 2 && __GNUC_MINOR__ == 7
+         syntax-error
+#endif
+       ], ac_cv_c_const=no))
+fi
+])
 if test $ac_cv_c_const = no; then
   AC_DEFINE(const, )
 fi