]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Create src/mkcustom.h which is included by config.h
authorPaul Smith <psmith@gnu.org>
Sun, 8 Jan 2023 14:38:59 +0000 (09:38 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 8 Jan 2023 15:45:24 +0000 (10:45 -0500)
Put declarations for missing functions which we create in src/misc.c
into a file which is included by config.h via AH_BOTTOM().  This
ensures those prototypes are available, even in files added to
lib/... from gnulib.

* src/mkcustom.h: Add a new file with function declarations.
* configure.ac: Include src/mkcustom.h in config.h with AH_BOTTOM()
* Makefile.am: Add the header to the SRCS list.
* src/makeint.h: Remove content that we added to src/mkcustom.h.
* src/config.ami: Add #include "mkcustom.h" to specialized config.h.
* src/config.h-vms: Ditto.
* src/config.h.W32: Ditto.
* src/configh.dos: Ditto.

Makefile.am
configure.ac
src/config.ami
src/config.h-vms
src/config.h.W32
src/configh.dos
src/makeint.h
src/mkcustom.h [new file with mode: 0644]

index 082ba42cf5928c51d14cac53af20887409b554c8..49190d640bf3e93f809b8d2c5176555e32fd7ff2 100644 (file)
@@ -34,8 +34,8 @@ make_SRCS =   src/ar.c src/arscan.c src/commands.c src/commands.h \
                src/getopt.h src/getopt1.c src/gettext.h src/guile.c \
                src/hash.c src/hash.h src/implicit.c src/job.c src/job.h \
                src/load.c src/loadapi.c src/main.c src/makeint.h src/misc.c \
-               src/os.h src/output.c src/output.h src/read.c src/remake.c \
-               src/rule.c src/rule.h src/shuffle.h src/shuffle.c \
+               src/mkcustom.h src/os.h src/output.c src/output.h src/read.c \
+               src/remake.c src/rule.c src/rule.h src/shuffle.h src/shuffle.c \
                src/signame.c src/strcache.c src/variable.c src/variable.h \
                src/version.c src/vpath.c
 
index 8466d36f0efddb152c2cd622a16418d3bc044158..f5781853651083c1ec2532c2f91329c9089ef3a6 100644 (file)
@@ -471,6 +471,10 @@ AC_SUBST_FILE([MAINT_MAKEFILE])
 # Allow building with dmalloc
 AM_WITH_DMALLOC
 
+# Add custom header to config.h
+AH_BOTTOM([/* Include customized declarations.  */
+#include "../src/mkcustom.h"])
+
 # Forcibly disable SET_MAKE.  If it's set it breaks things like the test
 # scripts, etc.
 SET_MAKE=
index 543baae3e7961b0f6caedf7f40e5ca4954c5698d..4b70419f487dc4c932c933075fa206df63737741 100644 (file)
@@ -329,3 +329,6 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* Define to `int' if <sys/types.h> does not define. */
 #define ssize_t int
+
+/* Include customized declarations.  */
+#include "../src/mkcustom.h"
index c6cd31df6f5847b0539ae516e2d8532aaf78c9fd..0aeffd6b9e543188c38924f79910ece8ca114000 100644 (file)
@@ -428,3 +428,6 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* Build host information. */
 #define MAKE_HOST "VMS"
+
+/* Include customized declarations.  */
+#include "../src/mkcustom.h"
index df811e4d3417fa465530a8c32b554a4d070d711a..bf23d8d94e0beeb233c6bbeb02f06b390c530cea 100644 (file)
@@ -629,3 +629,6 @@ char *ttyname (int);
 #ifdef HAVE_CYGWIN_SHELL
 #undef BATCH_MODE_ONLY_SHELL
 #endif
+
+/* Include customized declarations.  */
+#include "../src/mkcustom.h"
index a00fecde80d07d5a9fab76dd2f5202180f43b16c..f49462ac2b9b8b71806781ba6c100eec5a04e5cd 100644 (file)
@@ -109,3 +109,6 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 /* Define to 'unsigned long' or 'unsigned long long'
    if <inttypes.h> doesn't define.  */
 #define uintmax_t unsigned long long
+
+/* Include customized declarations.  */
+#include "../src/mkcustom.h"
index b5f63b1663f1ea684e8a8ff9366a46e8713ad54f..fe49cffd0695b3ba433337287d0ee33046671b69 100644 (file)
@@ -18,28 +18,6 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
    (which it would do because makeint.h was found in $srcdir).  */
 #include <config.h>
-#undef  HAVE_CONFIG_H
-#define HAVE_CONFIG_H 1
-
-/* Specify we want GNU source code.  This must be defined before any
-   system headers are included.  */
-
-#define _GNU_SOURCE 1
-
-/* AIX requires this to be the first thing in the file.  */
-#if HAVE_ALLOCA_H
-# include <alloca.h>
-#else
-# ifdef _AIX
- #pragma alloca
-# else
-#  if !defined(__GNUC__) && !defined(WINDOWS32)
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
 
 /* Some versions of GCC (e.g., 10.x) set the warn_unused_result attribute on
    __builtin_alloca.  This causes alloca(0) to fail and is not easily worked
@@ -82,7 +60,6 @@ char *alloca ();
 # define __NO_STRING_INLINES
 #endif
 
-#include <stddef.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <signal.h>
@@ -712,9 +689,6 @@ char *getwd (void);
 #  define strcasecmp stricmp
 # elif HAVE_STRCMPI
 #  define strcasecmp strcmpi
-# else
-/* Create our own, in misc.c */
-int strcasecmp (const char *s1, const char *s2);
 # endif
 #endif
 
@@ -723,22 +697,9 @@ int strcasecmp (const char *s1, const char *s2);
 #  define strncasecmp strnicmp
 # elif HAVE_STRNCMPI
 #  define strncasecmp strncmpi
-# else
-/* Create our own, in misc.c */
-int strncasecmp (const char *s1, const char *s2, size_t n);
 # endif
 #endif
 
-#if !HAVE_MEMPCPY
-/* Create our own, in misc.c */
-void *mempcpy (void *dest, const void *src, size_t n);
-#endif
-
-#if !HAVE_STPCPY
-/* Create our own, in misc.c */
-char *stpcpy (char *dest, const char *src);
-#endif
-
 #define OUTPUT_SYNC_NONE    0
 #define OUTPUT_SYNC_LINE    1
 #define OUTPUT_SYNC_TARGET  2
diff --git a/src/mkcustom.h b/src/mkcustom.h
new file mode 100644 (file)
index 0000000..035c50b
--- /dev/null
@@ -0,0 +1,65 @@
+/* Miscellaneous global declarations and portability cruft for GNU Make.
+Copyright (C) 2023 Free Software Foundation, Inc.
+This file is part of GNU Make.
+
+GNU Make is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3 of the License, or (at your option) any later
+version.
+
+GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+  This file is included at the end of config.h
+
+   That means it's included _everywhere_ as the first thing,
+   INCLUDING content imported from gnulib.  BE AWARE!!
+*/
+
+#undef  HAVE_CONFIG_H
+#define HAVE_CONFIG_H 1
+
+/* Specify we want GNU source code.  This must be defined before any
+   system headers are included.  */
+
+#define _GNU_SOURCE 1
+
+/* AIX requires this to be the first thing in the file.  */
+#if HAVE_ALLOCA_H
+# include <alloca.h>
+#else
+# ifdef _AIX
+ #pragma alloca
+# else
+#  if !defined(__GNUC__) && !defined(WINDOWS32)
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+
+/* Declare function prototypes for src/misc.c functions if needed.  */
+
+#include <stddef.h>
+
+#if !HAVE_STRCASECMP && !HAVE_STRICMP && !HAVE_STRCMPI
+int strcasecmp (const char *s1, const char *s2);
+#endif
+
+#if !HAVE_STRNCASECMP && !HAVE_STRNICMP && !HAVE_STRNCMPI
+int strncasecmp (const char *s1, const char *s2, size_t n);
+#endif
+
+#if !HAVE_MEMPCPY
+void *mempcpy (void *dest, const void *src, size_t n);
+#endif
+
+#if !HAVE_STPCPY
+char *stpcpy (char *dest, const char *src);
+#endif