From f305a52c02cd17188bb6cc429d56c5912c976229 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 6 Mar 2004 08:05:17 +0000 Subject: [PATCH] Don't use __STDC__; some compilers don't set it properly. Use autoconf's test to set HAVE_ANSI_COMPILER and check that instead. --- ChangeLog | 11 +++++++++++ NEWS | 2 +- config.ami.template | 3 +++ config.h-vms.template | 3 +++ config.h.W32.template | 3 +++ configh.dos.template | 6 ++++++ configure.in | 8 +++++++- make.h | 2 +- misc.c | 6 +++--- 9 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56bdec3..4d5e0f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-03-06 Paul D. Smith + + * configure.in (HAVE_ANSI_COMPILER): Define if we have an ANSI/ISO + compiler. + * make.h: Convert uses of __STDC__ to HAVE_ANSI_COMPILER. + * misc.c (message,error,fatal): Ditto. + * configh.dos.template: Define HAVE_ANSI_COMPILER. + * config.h.W32.template: Ditto. + * config.h-vms.template: Ditto. + * config.ami.template: Ditto. + 2004-03-04 Paul D. Smith * README.template: Add a note about broken /bin/sh on SunOS diff --git a/NEWS b/NEWS index 4034048..49f4f57 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ GNU make NEWS -*-indented-text-*- History of user-visible changes. - 04 March 2004 + 06 March 2004 Copyright (C) 2002,2003,2004 Free Software Foundation, Inc. See the end for copying conditions. diff --git a/config.ami.template b/config.ami.template index 6840765..df00075 100644 --- a/config.ami.template +++ b/config.ami.template @@ -146,6 +146,9 @@ /* Define if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ +/* Define if your compiler conforms to the ANSI C standard. */ +#define HAVE_ANSI_COMPILER 1 + /* Define if you have the ANSI C header files. */ #define STDC_HEADERS diff --git a/config.h-vms.template b/config.h-vms.template index dc599f0..118627d 100644 --- a/config.h-vms.template +++ b/config.h-vms.template @@ -306,6 +306,9 @@ /* Define if you have the header file. */ /* #undef HAVE_NDIR_H */ +/* Define if your compiler conforms to the ANSI C standard. */ +#define HAVE_ANSI_COMPILER 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 diff --git a/config.h.W32.template b/config.h.W32.template index 8fbeecd..edb2f29 100644 --- a/config.h.W32.template +++ b/config.h.W32.template @@ -158,6 +158,9 @@ /* Define if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ +/* Define if your compiler conforms to the ANSI C standard. */ +#define HAVE_ANSI_COMPILER 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDARG_H 1 diff --git a/configh.dos.template b/configh.dos.template index 40ef770..21a4427 100644 --- a/configh.dos.template +++ b/configh.dos.template @@ -56,6 +56,12 @@ /* Define if you have the select function. */ #define HAVE_SELECT 1 +/* Define if your compiler conforms to the ANSI C standard. */ +#define HAVE_ANSI_COMPILER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + /* Define if you have the vprintf library function. */ #undef HAVE_VPRINTF #define HAVE_VPRINTF 1 diff --git a/configure.in b/configure.in index 3828be7..967a8ed 100644 --- a/configure.in +++ b/configure.in @@ -52,11 +52,17 @@ AC_HEADER_TIME AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \ memory.h sys/param.h sys/time.h sys/timeb.h) +# Set a flag if we have an ANSI C compiler +if test "$ac_cv_prog_cc_stdc" != no; then + AC_DEFINE(HAVE_ANSI_COMPILER, 1, + [Define if your compiler conforms to the ANSI C standard.]) +fi + + # Determine what kind of variadic function calls we support AC_CHECK_HEADERS(stdarg.h varargs.h, break) AM_PROG_CC_C_O -AM_PROG_CC_STDC AC_C_CONST AC_TYPE_SIGNAL AC_TYPE_UID_T diff --git a/make.h b/make.h index 453e9f5..ea8f07c 100644 --- a/make.h +++ b/make.h @@ -396,7 +396,7 @@ struct floc # endif #endif -#if __STDC__ && USE_VARIADIC && HAVE_STDARG_H +#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H extern void message (int prefix, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern void error (const struct floc *flocp, const char *fmt, ...) diff --git a/misc.c b/misc.c index 07a9c47..9d3ff4f 100644 --- a/misc.c +++ b/misc.c @@ -205,7 +205,7 @@ concat (const char *s1, const char *s2, const char *s3) /* Print a message on stdout. */ void -#if __STDC__ && USE_VARIADIC && HAVE_STDARG_H +#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H message (int prefix, const char *fmt, ...) #else message (prefix, fmt, va_alist) @@ -241,7 +241,7 @@ message (prefix, fmt, va_alist) /* Print an error message. */ void -#if __STDC__ && USE_VARIADIC && HAVE_STDARG_H +#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H error (const struct floc *flocp, const char *fmt, ...) #else error (flocp, fmt, va_alist) @@ -274,7 +274,7 @@ error (flocp, fmt, va_alist) /* Print an error message and exit. */ void -#if __STDC__ && USE_VARIADIC && HAVE_STDARG_H +#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H fatal (const struct floc *flocp, const char *fmt, ...) #else fatal (flocp, fmt, va_alist) -- 2.7.4