assume config.h

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm not ready to use the gnulib config-h module yet, since I still have to
figure out how to play with the bootstrap script to ensure that libtool
will work without -DHAVE_CONFIG_H provided by make.  But since gnulib now
assumes config.h, we might as well do likewise.  This also ports the
platform detection macros from the branch.

2006-09-26  Eric Blake  <[email protected]>

	* configure.ac (AC_CONFIG_HEADERS): Place <config.h> with other
	gnulib headers.
	* Makefile.am (AUTOMAKE_OPTIONS): Add nostdinc, to reduce length
	of lines during make.
	(AM_CPPFLAGS): Remove unneeded include path.
	(src_m4_CPPFLAGS): Remove redundant include path.
	* m4/system_.h Make preprocessor indentation consistent.
	(M4_DIRSEP_CHAR, M4_PATHSEP_CHAR, M4_GNUC_FORMAT): Remove unused
	macros.
	(UNIX, W32_NATIVE, OS2): Update platform recognition macros from
	branch.
	(M4_GNUC_PRINTF, M4_GNUC_SCANF, M4_GNUC_NORETURN)
	(M4_GNUC_CONST, M4_GNUC_UNUSED): Mangle names properly for header.
	(bool, true, false): Don't undefine here; stdbool takes care of
	that.
	* src/m4.h (includes): Assume config.h, and several standard
	headers.
	(__CYGWIN__, WIN32): Don't define here; let system.h do it.
	* m4/m4private.h: Assume config.h.
	* m4/output.c: Likewise.
	* m4/path.c: Likewise.
	* m4/resyntax.c: Likewise.
	* m4/utility.c: Likewise.
	* modules/gnu.c: Likewise.
	* modules/import.c: Likewise.
	* modules/load.c: Likewise.
	* modules/m4.c: Likewise.
	* modules/modtest.c: Likewise.
	* modules/mpeval.c: Likewise.
	* modules/perl.c: Likewise.
	* modules/shadow.c: Likewise.
	* modules/stdlib.c: Likewise.
	* modules/time.c: Likewise.
	* modules/traditional.c: Likewise.

- --
Life is short - so eat dessert first!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFGSjM84KuGfSFAYARAqhfAJ9VBVpb7r75NC2Gndz+RzDV3j0/ewCgx493
4fZ07yyiEpXXDcaYwHwBDug=
=KaTx
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch164 (text/plain, 15.8 KB)
Index: Makefile.am
===================================================================
RCS file: /sources/m4/m4/Makefile.am,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.am
--- Makefile.am	14 Sep 2006 00:37:26 -0000	1.46
+++ Makefile.am	26 Sep 2006 13:13:16 -0000
@@ -26,10 +26,11 @@ config_macro_dir= ltdl/m4
 SUBDIRS		= ltdl po gnu .
 
 ACLOCAL_AMFLAGS = -I ltdl/m4
+AUTOMAKE_OPTIONS = nostdinc
 AM_CPPFLAGS	= -I. -I$(srcdir) \
 		  -Ignu -I$(srcdir)/gnu \
-		  -Im4 -I$(srcdir)/m4\
-		  $(INTLINCL) $(LTDLINCL)
+		  -Im4 -I$(srcdir)/m4 \
+		  $(LTDLINCL)
 AM_LDFLAGS	= -no-undefined -export-dynamic
 
 EXTRA_DIST	= bootstrap \
@@ -85,7 +86,7 @@ endif
 if STACKOVF
 src_m4_SOURCES += src/stackovf.c
 endif
-src_m4_CPPFLAGS	= $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src $(LTDLINCL)
+src_m4_CPPFLAGS	= $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
 src_m4_LDFLAGS	= $(AM_LDFLAGS) $(DLPREOPEN)
 src_m4_LDADD	= m4/libm4.la
 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
Index: configure.ac
===================================================================
RCS file: /sources/m4/m4/configure.ac,v
retrieving revision 1.55
diff -u -p -r1.55 configure.ac
--- configure.ac	5 Sep 2006 16:58:02 -0000	1.55
+++ configure.ac	26 Sep 2006 13:13:16 -0000
@@ -29,7 +29,7 @@ AC_CONFIG_AUX_DIR([ltdl/config])
 AC_CONFIG_MACRO_DIR([ltdl/m4])
 AC_CONFIG_LIBOBJ_DIR([gnu])
 AC_CONFIG_TESTDIR([tests])
-AC_CONFIG_HEADERS([config.h:config-h.in])
+AC_CONFIG_HEADERS([gnu/config.h:config-h.in])
 AC_CONFIG_FILES([tests/m4], [chmod +x tests/m4])
 
 
Index: m4/m4private.h
===================================================================
RCS file: /sources/m4/m4/m4/m4private.h,v
retrieving revision 1.62
diff -u -p -r1.62 m4private.h
--- m4/m4private.h	18 Sep 2006 13:16:44 -0000	1.62
+++ m4/m4private.h	26 Sep 2006 13:13:16 -0000
@@ -22,9 +22,7 @@
 #ifndef M4PRIVATE_H
 #define M4PRIVATE_H 1
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <assert.h>
 #include <errno.h>
Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.28
diff -u -p -r1.28 output.c
--- m4/output.c	5 Sep 2006 16:58:02 -0000	1.28
+++ m4/output.c	26 Sep 2006 13:13:16 -0000
@@ -18,9 +18,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <errno.h>
 #include <stdio.h>
Index: m4/path.c
===================================================================
RCS file: /sources/m4/m4/m4/path.c,v
retrieving revision 1.20
diff -u -p -r1.20 path.c
--- m4/path.c	5 Sep 2006 23:16:40 -0000	1.20
+++ m4/path.c	26 Sep 2006 13:13:16 -0000
@@ -22,9 +22,7 @@
 /* Handling of path search of included files via the builtins "include"
    and "sinclude".  */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <stdlib.h>
 #include <string.h>
Index: m4/resyntax.c
===================================================================
RCS file: /sources/m4/m4/m4/resyntax.c,v
retrieving revision 1.1
diff -u -p -r1.1 resyntax.c
--- m4/resyntax.c	13 Jul 2006 23:35:16 -0000	1.1
+++ m4/resyntax.c	26 Sep 2006 13:13:16 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <regex.h>
 #include <string.h>
@@ -27,7 +25,7 @@
 #include "m4private.h"
 
 typedef struct {
-  const char 	*spec;
+  const char	*spec;
   const int	code;
 } m4_resyntax;
 
Index: m4/system_.h
===================================================================
RCS file: /sources/m4/m4/m4/system_.h,v
retrieving revision 1.14
diff -u -p -r1.14 system_.h
--- m4/system_.h	22 Aug 2006 16:16:47 -0000	1.14
+++ m4/system_.h	26 Sep 2006 13:13:16 -0000
@@ -34,12 +34,6 @@
 @INCLUDE_ERROR_H@
 @INCLUDE_OBSTACK_H@
 @INCLUDE_REGEX_H@
-
-/* These are not in m4's namespace so for safety undefine any errant
-   definitions before including stdbool.h.  */
-#undef bool
-#undef false
-#undef true
 @INCLUDE_STDBOOL_H@
 
 #include <gnu/exit.h>
@@ -55,12 +49,12 @@
    behaviour of the including program whether ENABLE_NLS is defined
    or not.  */
 #ifndef _
-#  ifdef ENABLE_NLS
-#    include <libintl.h>
-#    define _(Text) gettext ((Text))
-#  else
-#    define _(Text) (Text)
-#  endif
+# ifdef ENABLE_NLS
+#  include <libintl.h>
+#  define _(Text) gettext ((Text))
+# else
+#  define _(Text) (Text)
+# endif
 #endif
 
 
@@ -70,78 +64,78 @@
    everything else should go inside.  */
 
 #ifndef BEGIN_C_DECLS
-#  ifdef __cplusplus
-#    define BEGIN_C_DECLS	extern "C" {
-#    define END_C_DECLS		}
-#  else /* !__cplusplus */
-#    define BEGIN_C_DECLS	/* empty */
-#    define END_C_DECLS		/* empty */
-#  endif /* __cplusplus */
+# ifdef __cplusplus
+#  define BEGIN_C_DECLS	extern "C" {
+#  define END_C_DECLS		}
+# else /* !__cplusplus */
+#  define BEGIN_C_DECLS	/* empty */
+#  define END_C_DECLS		/* empty */
+# endif /* __cplusplus */
 #endif /* !BEGIN_C_DECLS */
 
 BEGIN_C_DECLS
 
 
 
-/* Canonicalise Windows and Cygwin recognition macros.  */
-#if defined __CYGWIN32__ && !defined __CYGWIN__
-#  define __CYGWIN__ __CYGWIN32__
-#endif
-#if defined _WIN32 && !defined WIN32
-#  define WIN32 _WIN32
-#endif
-
-#if defined WIN32 && !defined __CYGWIN__
-/* M4_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
-   separator when it is set. */
-#  define M4_DIRSEP_CHAR	'\\'
-#  define M4_PATHSEP_CHAR	';'
-#endif
-#ifndef M4_PATHSEP_CHAR
-#  define M4_PATHSEP_CHAR	':'
+/* Canonicalize UNIX recognition macros.  */
+#if defined unix || defined __unix || defined __unix__ \
+  || defined _POSIX_VERSION || defined _POSIX2_VERSION \
+  || defined __NetBSD__ || defined __OpenBSD__ \
+  || defined __APPLE__ || defined __APPLE_CC__
+# define UNIX 1
+#endif
+
+/* Canonicalize Windows recognition macros.  */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+# define W32_NATIVE 1
+#endif
+
+/* Canonicalize OS/2 recognition macro.  */
+#ifdef __EMX__
+# define OS2 1
 #endif
 
-
 
 /* M4_STMT_START/END are used to create macros which expand to a
    a single compound statement in a portable way, but crucially in
-   a way sympathetic to the compiler to maximise optimisation.  */
+   a way sympathetic to the compiler to maximise optimization.  */
 #undef M4_STMT_START
 #undef M4_STMT_END
 #if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
-#  define M4_STMT_START        (void)(
-#  define M4_STMT_END          )
+# define M4_STMT_START        (void)(
+# define M4_STMT_END          )
 #else
-#  if (defined (sun) || defined (__sun__))
-#    define M4_STMT_START      if (1)
-#    define M4_STMT_END        else (void)0
-#  else
-#    define M4_STMT_START      do
-#    define M4_STMT_END        while (0)
-#  endif
+# if (defined (sun) || defined (__sun__))
+#  define M4_STMT_START      if (1)
+#  define M4_STMT_END        else (void)0
+# else
+#  define M4_STMT_START      do
+#  define M4_STMT_END        while (0)
+# endif
 #endif
 
 
 
-/* Take advantage of GNU C compiler source level optimisation hints,
+/* Take advantage of GNU C compiler source level optimization hints,
    using portable macros.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#  define M4_GNUC_ATTRIBUTE(args)	__attribute__(args)
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
+# define M4_GNUC_ATTRIBUTE(args)	__attribute__(args)
 #else
-#  define M4_GNUC_ATTRIBUTE(args)
+# define M4_GNUC_ATTRIBUTE(args)
 #endif  /* __GNUC__ */
 
-#define M4_GNUC_PRINTF(fmt, arg) M4_GNUC_ATTRIBUTE((format (printf, fmt, arg)))
-#define M4_GNUC_SCANF(fmt, arg)	M4_GNUC_ATTRIBUTE((format (scanf, fmt, arg)))
-#define M4_GNUC_FORMAT(arg_idx)	M4_GNUC_ATTRIBUTE((format_arg (arg_idx)))
-#define M4_GNUC_NORETURN	M4_GNUC_ATTRIBUTE((noreturn))
-#define M4_GNUC_CONST		M4_GNUC_ATTRIBUTE((const))
-#define M4_GNUC_UNUSED		M4_GNUC_ATTRIBUTE((unused))
+#define M4_GNUC_PRINTF(fmt, arg)				\
+  M4_GNUC_ATTRIBUTE((__format__ (__printf__, fmt, arg)))
+#define M4_GNUC_SCANF(fmt, arg)					\
+  M4_GNUC_ATTRIBUTE((__format__ (__scanf__, fmt, arg)))
+#define M4_GNUC_NORETURN	M4_GNUC_ATTRIBUTE((__noreturn__))
+#define M4_GNUC_CONST		M4_GNUC_ATTRIBUTE((__const__))
+#define M4_GNUC_UNUSED		M4_GNUC_ATTRIBUTE((__unused__))
 
 
 
 #if !defined __PRETTY_FUNCTION__
-#  define __PRETTY_FUNCTION__	"<unknown>"
+# define __PRETTY_FUNCTION__	"<unknown>"
 #endif
 
 
@@ -151,13 +145,13 @@ BEGIN_C_DECLS
    if the arguments to STR() (or CONC()) are themselves macros, they will
    be expanded before being quoted.   */
 #ifndef STR
-#  define _STR(arg)	#arg
-#  define STR(arg)	_STR(arg)
+# define _STR(arg)	#arg
+# define STR(arg)	_STR(arg)
 #endif
 
 #ifndef CONC
-#  define _CONC(a, b)	a##b
-#  define CONC(a, b)	_CONC(a, b)
+# define _CONC(a, b)	a##b
+# define CONC(a, b)	_CONC(a, b)
 #endif
 
 END_C_DECLS
Index: m4/utility.c
===================================================================
RCS file: /sources/m4/m4/m4/utility.c,v
retrieving revision 1.48
diff -u -p -r1.48 utility.c
--- m4/utility.c	7 Sep 2006 23:53:04 -0000	1.48
+++ m4/utility.c	26 Sep 2006 13:13:16 -0000
@@ -18,9 +18,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include "m4private.h"
 #include "verror.h"
Index: modules/gnu.c
===================================================================
RCS file: /sources/m4/m4/modules/gnu.c,v
retrieving revision 1.56
diff -u -p -r1.56 gnu.c
--- modules/gnu.c	19 Sep 2006 11:41:25 -0000	1.56
+++ modules/gnu.c	26 Sep 2006 13:13:16 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 #include <modules/m4.h>
Index: modules/import.c
===================================================================
RCS file: /sources/m4/m4/modules/import.c,v
retrieving revision 1.5
diff -u -p -r1.5 import.c
--- modules/import.c	25 Aug 2006 22:06:42 -0000	1.5
+++ modules/import.c	26 Sep 2006 13:13:16 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 
Index: modules/load.c
===================================================================
RCS file: /sources/m4/m4/modules/load.c,v
retrieving revision 1.19
diff -u -p -r1.19 load.c
--- modules/load.c	19 Sep 2006 11:41:25 -0000	1.19
+++ modules/load.c	26 Sep 2006 13:13:16 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 #include "m4private.h"
Index: modules/m4.c
===================================================================
RCS file: /sources/m4/m4/modules/m4.c,v
retrieving revision 1.71
diff -u -p -r1.71 m4.c
--- modules/m4.c	18 Sep 2006 13:16:44 -0000	1.71
+++ modules/m4.c	26 Sep 2006 13:13:17 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <assert.h>
 #include <errno.h>
Index: modules/modtest.c
===================================================================
RCS file: /sources/m4/m4/modules/modtest.c,v
retrieving revision 1.13
diff -u -p -r1.13 modtest.c
--- modules/modtest.c	25 Aug 2006 22:06:42 -0000	1.13
+++ modules/modtest.c	26 Sep 2006 13:13:17 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 
Index: modules/mpeval.c
===================================================================
RCS file: /sources/m4/m4/modules/mpeval.c,v
retrieving revision 1.19
diff -u -p -r1.19 mpeval.c
--- modules/mpeval.c	25 Aug 2006 22:06:42 -0000	1.19
+++ modules/mpeval.c	26 Sep 2006 13:13:17 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 
Index: modules/perl.c
===================================================================
RCS file: /sources/m4/m4/modules/perl.c,v
retrieving revision 1.15
diff -u -p -r1.15 perl.c
--- modules/perl.c	25 Aug 2006 22:06:42 -0000	1.15
+++ modules/perl.c	26 Sep 2006 13:13:17 -0000
@@ -17,11 +17,9 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
-#undef PACKAGE
+#include <config.h>
 
+#undef PACKAGE
 #include "perlxsi.c"			/* Perl stuff */
 #undef try
 #undef _
Index: modules/shadow.c
===================================================================
RCS file: /sources/m4/m4/modules/shadow.c,v
retrieving revision 1.12
diff -u -p -r1.12 shadow.c
--- modules/shadow.c	25 Aug 2006 22:06:42 -0000	1.12
+++ modules/shadow.c	26 Sep 2006 13:13:17 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 
Index: modules/stdlib.c
===================================================================
RCS file: /sources/m4/m4/modules/stdlib.c,v
retrieving revision 1.14
diff -u -p -r1.14 stdlib.c
--- modules/stdlib.c	25 Aug 2006 22:06:42 -0000	1.14
+++ modules/stdlib.c	26 Sep 2006 13:13:17 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <pwd.h>
 #include <stdlib.h>
Index: modules/time.c
===================================================================
RCS file: /sources/m4/m4/modules/time.c,v
retrieving revision 1.15
diff -u -p -r1.15 time.c
--- modules/time.c	25 Aug 2006 22:06:42 -0000	1.15
+++ modules/time.c	26 Sep 2006 13:13:17 -0000
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <stdio.h>
 
Index: modules/traditional.c
===================================================================
RCS file: /sources/m4/m4/modules/traditional.c,v
retrieving revision 1.4
diff -u -p -r1.4 traditional.c
--- modules/traditional.c	1 May 2005 11:10:05 -0000	1.4
+++ modules/traditional.c	26 Sep 2006 13:13:17 -0000
@@ -1,5 +1,5 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@
    02110-1301  USA
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <m4module.h>
 
Index: src/m4.h
===================================================================
RCS file: /sources/m4/m4/src/m4.h,v
retrieving revision 1.20
diff -u -p -r1.20 m4.h
--- src/m4.h	7 Jul 2006 13:07:48 -0000	1.20
+++ src/m4.h	26 Sep 2006 13:13:17 -0000
@@ -21,69 +21,18 @@
 #ifndef M4_H
 #define M4_H
 
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Canonicalise Windows and Cygwin recognition macros.  */
-#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-#endif
-#if defined(_WIN32) && !defined(WIN32)
-# define WIN32 _WIN32
-#endif
+#include <config.h>
 
-#include <sys/types.h>
-#include <stdio.h>
 #include <ctype.h>
-
-#include "m4module.h"
-
-/* An ANSI string.h and pre-ANSI memory.h might conflict.  */
-
-#if defined (HAVE_STRING_H) || defined (STDC_HEADERS)
-# include <string.h>
-# if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
-#  include <memory.h>
-# endif
-#else
-# include <strings.h>
-# ifndef memcpy
-#  define memcpy(D, S, N) bcopy((S), (D), (N))
-# endif
-# ifndef strchr
-#  define strchr(S, C) index ((S), (C))
-# endif
-# ifndef strrchr
-#  define strrchr(S, C) rindex ((S), (C))
-# endif
-# ifndef bcopy
-void bcopy ();
-# endif
-#endif
-
-#if STDC_HEADERS || HAVE_STDLIB_H
-#  include <stdlib.h>
-#else /* not STDC_HEADERS */
-
-voidstar malloc ();
-voidstar realloc ();
-char *getenv ();
-double atof ();
-long strtol ();
-
-#endif /* STDC_HEADERS */
-
 #include <errno.h>
 #include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include "m4module.h"
 
 #if HAVE_LOCALE_H
 # include <locale.h>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.