]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Include <strings.h> globally
authorPaul Smith <psmith@gnu.org>
Sun, 8 Jan 2023 02:59:16 +0000 (21:59 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 8 Jan 2023 15:24:09 +0000 (10:24 -0500)
Various code uses str{,n}casecmp() so include <strings.h>, if it
exists, everywhere.

* configure.ac: Check for <strings.h> explicitly.
* src/makeint.h: Include it if HAVE_STRINGS_H, for str{,n}casecmp().
* src/job.c: Remove include of <strings.h>.
* src/main.c: Ditto.

configure.ac
src/job.c
src/main.c
src/makeint.h

index 4de0076de232cf6c3ab95677e5443ab6bababfcb..8466d36f0efddb152c2cd622a16418d3bc044158 100644 (file)
@@ -64,9 +64,9 @@ AC_SEARCH_LIBS([getpwnam], [sun])
 AC_HEADER_DIRENT
 AC_HEADER_STAT
 
-AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
+AC_CHECK_HEADERS([stdlib.h string.h strings.h locale.h unistd.h limits.h \
                   memory.h sys/param.h sys/resource.h sys/timeb.h sys/time.h \
-                  sys/select.h sys/file.h spawn.h])
+                  sys/select.h sys/file.h fcntl.h spawn.h])
 
 AM_PROG_CC_C_O
 AC_C_CONST
index 35fbda004773e2279354bd588c440190d99e8af4..a42c426c4f27b13d613fc9eb549c505dee9b8910 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -30,9 +30,6 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* Default shell to use.  */
 #ifdef WINDOWS32
-# ifdef HAVE_STRINGS_H
-#  include <strings.h>  /* for strcasecmp, strncasecmp */
-# endif
 # include <windows.h>
 
 const char *default_shell = "sh.exe";
index 93fca9ac1c7a7fcd9569b9ceb3f86e84c31bd872..4d4b88fe7d0cbf07de86c31ee7d63927e48ae1aa 100644 (file)
@@ -34,9 +34,6 @@ this program.  If not, see <https://www.gnu.org/licenses/>.  */
 #ifdef WINDOWS32
 # include <windows.h>
 # include <io.h>
-#ifdef HAVE_STRINGS_H
-# include <strings.h> /* for strcasecmp */
-#endif
 # include "pathstuff.h"
 # include "sub_proc.h"
 # include "w32err.h"
index 4bcf7b7704ecf1b0bc6f190fcda657b53f8e110f..b5f63b1663f1ea684e8a8ff9366a46e8713ad54f 100644 (file)
@@ -251,8 +251,6 @@ extern int vms_unix_simulation;
 # ifdef HAVE_STRING_H
 #  include <string.h>
 #  define ANSI_STRING 1
-# else
-#  include <strings.h>
 # endif
 # ifdef HAVE_MEMORY_H
 #  include <memory.h>
@@ -296,6 +294,10 @@ char *strerror (int errnum);
 # include <stdint.h>
 #endif
 
+#if HAVE_STRINGS_H
+# include <strings.h>  /* Needed for strcasecmp / strncasecmp.  */
+#endif
+
 #if defined _MSC_VER || defined __MINGW32__
 # define MK_PRI64_PREFIX "I64"
 #else