[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Detection of ISO C89 compiler
From: |
Paul Eggert |
Subject: |
Re: Detection of ISO C89 compiler |
Date: |
Sat, 20 Nov 2010 15:29:10 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 |
On 11/19/2010 03:49 AM, Patrick Pelissier wrote:
> But I still wonder why the test detecting an ISO C89 compiler
> uses sys/types.h and sys/stat.h.
I expect it's an oversight. That test was stolen from RCS 5.7, dated
1995, which assumed a POSIX-like environment. I installed
the following patch to fix things. Thanks for reporting the problem.
(It's vaguely possible that some ancient system failed to compile
sys/stat.h when in C89 mode, and that this was part of the test,
but if so, I doubt whether that's worth worrying about these days.)
>From 5ad7787f1967341cf356f9c3bd11c59f04a82d82 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Sat, 20 Nov 2010 15:26:39 -0800
Subject: [PATCH] autoconf: don't assume sys/stat.h and sys/types.h when testing
C89
Problem reported by Patrick Pelissier in
<http://lists.gnu.org/archive/html/bug-autoconf/2010-11/msg00019.html>.
* lib/autoconf/c.m4 (_AC_PROG_CC_C89): Don't include sys/types.h
and sys/stat.h. Instead, define a dummy struct stat. C89 doesn't
guarantee sys/types.h and sys/stat.h.
---
ChangeLog | 9 +++++++++
lib/autoconf/c.m4 | 3 +--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e34119c..62358ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-20 Paul Eggert <address@hidden>
+
+ autoconf: don't assume sys/stat.h and sys/types.h when testing C89
+ Problem reported by Patrick Pelissier in
+ <http://lists.gnu.org/archive/html/bug-autoconf/2010-11/msg00019.html>.
+ * lib/autoconf/c.m4 (_AC_PROG_CC_C89): Don't include sys/types.h
+ and sys/stat.h. Instead, define a dummy struct stat. C89 doesn't
+ guarantee sys/types.h and sys/stat.h.
+
2010-11-10 Reuben Thomas <address@hidden> (tiny change)
docs: avoid first person, and credit history to David MacKenzie
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 233644a..a873ccd 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1102,8 +1102,7 @@ AC_DEFUN([_AC_PROG_CC_C89],
[_AC_C_STD_TRY([c89],
[[#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
--
1.7.2