diff --git a/src/api/slurm_pmi.h b/src/api/slurm_pmi.h
index 8601fb7dba6193d5cf4375af3541c1910d8431f0..975ce969c4f4521774b395850a9cae8159b47b41 100644
--- a/src/api/slurm_pmi.h
+++ b/src/api/slurm_pmi.h
@@ -41,16 +41,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "src/common/pack.h"
 #include "src/common/slurm_protocol_defs.h"
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index f34c6503b59b7d5481d2c7d32bb8c747a9b2c63c..0de34f1219ca02f1c7e6da7f868a45825f1471c9 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -107,7 +107,6 @@ libcommon_la_SOURCES = 			\
 	arg_desc.c arg_desc.h		\
 	macros.h			\
 	malloc.c malloc.h		\
-	getopt.h getopt.c getopt1.c     \
 	$(build_unsetenv_src)		\
 	slurm_selecttype_info.c 	\
 	slurm_selecttype_info.h		\
diff --git a/src/common/Makefile.in b/src/common/Makefile.in
index 13bcc874467f92fe35c4c000d77f21cb872ba09c..555dff291b1d835a04ce51a11d13f0c81c573955 100644
--- a/src/common/Makefile.in
+++ b/src/common/Makefile.in
@@ -193,20 +193,20 @@ am__libcommon_la_SOURCES_DIST = assoc_mgr.c assoc_mgr.h \
 	slurm_acct_gather_filesystem.h slurm_jobcomp.c slurm_jobcomp.h \
 	slurm_route.c slurm_route.h slurm_time.c slurm_time.h \
 	slurm_topology.c slurm_topology.h switch.c switch.h arg_desc.c \
-	arg_desc.h macros.h malloc.c malloc.h getopt.h getopt.c \
-	getopt1.c unsetenv.c unsetenv.h slurm_selecttype_info.c \
-	slurm_selecttype_info.h slurm_resource_info.c \
-	slurm_resource_info.h hostlist.c hostlist.h \
-	slurm_step_layout.c slurm_step_layout.h checkpoint.c \
-	checkpoint.h job_resources.c job_resources.h parse_time.c \
-	parse_time.h job_options.c job_options.h global_defaults.c \
-	timers.c timers.h slurm_xlator.h stepd_api.c stepd_api.h \
-	write_labelled_message.c write_labelled_message.h proc_args.c \
-	proc_args.h slurm_strcasestr.c slurm_strcasestr.h node_conf.h \
-	node_conf.c gres.h gres.c entity.h entity.c layout.h layout.c \
-	layouts_mgr.h layouts_mgr.c mapping.c mapping.h \
-	xcgroup_read_config.c xcgroup_read_config.h xlua.c xlua.h \
-	callerid.c callerid.h siphash24.c siphash_slurm.c siphash.h
+	arg_desc.h macros.h malloc.c malloc.h unsetenv.c unsetenv.h \
+	slurm_selecttype_info.c slurm_selecttype_info.h \
+	slurm_resource_info.c slurm_resource_info.h hostlist.c \
+	hostlist.h slurm_step_layout.c slurm_step_layout.h \
+	checkpoint.c checkpoint.h job_resources.c job_resources.h \
+	parse_time.c parse_time.h job_options.c job_options.h \
+	global_defaults.c timers.c timers.h slurm_xlator.h stepd_api.c \
+	stepd_api.h write_labelled_message.c write_labelled_message.h \
+	proc_args.c proc_args.h slurm_strcasestr.c slurm_strcasestr.h \
+	node_conf.h node_conf.c gres.h gres.c entity.h entity.c \
+	layout.h layout.c layouts_mgr.h layouts_mgr.c mapping.c \
+	mapping.h xcgroup_read_config.c xcgroup_read_config.h xlua.c \
+	xlua.h callerid.c callerid.h siphash24.c siphash_slurm.c \
+	siphash.h
 @HAVE_UNSETENV_FALSE@am__objects_1 = unsetenv.lo
 am_libcommon_la_OBJECTS = assoc_mgr.lo cpu_frequency.lo \
 	node_features.lo xmalloc.lo xassert.lo xstring.lo xsignal.lo \
@@ -226,7 +226,7 @@ am_libcommon_la_OBJECTS = assoc_mgr.lo cpu_frequency.lo \
 	slurm_acct_gather_infiniband.lo \
 	slurm_acct_gather_filesystem.lo slurm_jobcomp.lo \
 	slurm_route.lo slurm_time.lo slurm_topology.lo switch.lo \
-	arg_desc.lo malloc.lo getopt.lo getopt1.lo $(am__objects_1) \
+	arg_desc.lo malloc.lo $(am__objects_1) \
 	slurm_selecttype_info.lo slurm_resource_info.lo hostlist.lo \
 	slurm_step_layout.lo checkpoint.lo job_resources.lo \
 	parse_time.lo job_options.lo global_defaults.lo timers.lo \
@@ -679,7 +679,6 @@ libcommon_la_SOURCES = \
 	arg_desc.c arg_desc.h		\
 	macros.h			\
 	malloc.c malloc.h		\
-	getopt.h getopt.c getopt1.c     \
 	$(build_unsetenv_src)		\
 	slurm_selecttype_info.c 	\
 	slurm_selecttype_info.h		\
@@ -827,8 +826,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/forward.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/global_defaults.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gres.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostlist.Plo@am__quote@
diff --git a/src/common/bitstring.h b/src/common/bitstring.h
index 4a1c5a34aa90feac0c2960280680585e9b11c1ed..42e37c5aaf811a99bce4d8a6453f7d9c211defb0 100644
--- a/src/common/bitstring.h
+++ b/src/common/bitstring.h
@@ -59,16 +59,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else	/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #define BITSTR_SHIFT_WORD8	3
 #define BITSTR_SHIFT_WORD32	5
diff --git a/src/common/callerid.c b/src/common/callerid.c
index e36c0c64358e62924ff9f13d8d06787a92ea769c..878cac4d0a46079380f7e6b36348e97282af7f83 100644
--- a/src/common/callerid.c
+++ b/src/common/callerid.c
@@ -36,37 +36,24 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
-
+#endif
 
 #ifndef _GNU_SOURCE
-#define _GNU_SOURCE
+#  define _GNU_SOURCE
 #endif
-#include <arpa/inet.h>
-#include <ctype.h>
 
 #ifdef __FreeBSD__
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #define s6_addr32 __u6_addr.__u6_addr32
 #endif
 
-#if HAVE_DIRENT_H
-#  include <dirent.h>
-#endif
+#include <arpa/inet.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <inttypes.h>
 #include <libgen.h>
 #include <stddef.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
diff --git a/src/common/env.c b/src/common/env.c
index c7da115e91a36c3c67a713e00ae420a630bbe8f7..debf307e556389a9d5a7eb27e14ab357d3c79bab 100644
--- a/src/common/env.c
+++ b/src/common/env.c
@@ -42,17 +42,17 @@
 #endif
 
 #include <fcntl.h>
-#include <stdio.h>
+#include <poll.h>
+#include <signal.h>
 #include <stdarg.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
-#include <unistd.h>
-#include <signal.h>
-#include <poll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/param.h>		/* MAXPATHLEN */
+#include <unistd.h>
+
 #include "slurm/slurm.h"
 #include "src/common/cpu_frequency.h"
 #include "src/common/log.h"
diff --git a/src/common/getopt.c b/src/common/getopt.c
deleted file mode 100644
index 183f58eb4f435d8e3bb2bb25989dba3ee5bb54fb..0000000000000000000000000000000000000000
--- a/src/common/getopt.c
+++ /dev/null
@@ -1,1061 +0,0 @@
-/* Getopt for GNU.
-   NOTE: getopt is now part of the C library, so if you don't know what
-   "Keep this file name-space clean" means, talk to drepper@gnu.org
-   before changing it!
-   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
-   	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301 USA.  */
-
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
-   Ditto for AIX 3.2 and <stdlib.h>.  */
-#ifndef _NO_PROTO
-# define _NO_PROTO
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if !defined __STDC__ || !__STDC__
-/* This is a separate conditional since some stdc systems
-   reject `defined (const)'.  */
-# ifndef const
-#  define const
-# endif
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "src/common/log.h"
-
-/* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself.  This code is part of the GNU C
-   Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object files,
-   it is simpler to just do this in the source for each such file.  */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-# include <gnu-versions.h>
-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#  define ELIDE_CODE
-# endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef	__GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
-   contain conflicting prototypes for getopt.  */
-# include <stdlib.h>
-# include <unistd.h>
-#endif	/* GNU C library.  */
-
-#ifdef VMS
-# include <unixlib.h>
-# if HAVE_STRING_H - 0
-#  include <string.h>
-# endif
-#endif
-
-#ifndef _
-/* This is for other GNU distributions with internationalized messages.  */
-# if defined HAVE_LIBINTL_H || defined _LIBC
-#  include <libintl.h>
-#  ifndef _
-#   define _(msgid)	gettext (msgid)
-#  endif
-# else
-#  define _(msgid)	(msgid)
-# endif
-#endif
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
-   but it behaves differently for the user, since it allows the user
-   to intersperse the options with the other arguments.
-
-   As `getopt' works, it permutes the elements of ARGV so that,
-   when it is done, all the options precede everything else.  Thus
-   all application programs are extended to handle flexible argument order.
-
-   Setting the environment variable POSIXLY_CORRECT disables permutation.
-   Then the behavior is completely standard.
-
-   GNU application programs can use a third alternative mode in which
-   they can distinguish the relative order of options and other arguments.  */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
-   the argument value is returned here.
-   Also, when `ordering' is RETURN_IN_ORDER,
-   each non-option ARGV-element is returned here.  */
-
-char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
-   This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
-
-   On entry to `getopt', zero means this is the first call; initialize.
-
-   When `getopt' returns -1, this is the index of the first of the
-   non-option elements that the caller should itself scan.
-
-   Otherwise, `optind' communicates from one call to the next
-   how much of ARGV has been scanned so far.  */
-
-/* 1003.2 says this must be 1 before any call.  */
-int optind = 1;
-
-/* Formerly, initialization of getopt depended on optind==0, which
-   causes problems with re-calling getopt as programs generally don't
-   know that. */
-
-int __getopt_initialized;
-
-/* The next char to be scanned in the option-element
-   in which the last option character we returned was found.
-   This allows us to pick up the scan where we left off.
-
-   If this is zero, or a null string, it means resume the scan
-   by advancing to the next ARGV-element.  */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
-   for unrecognized options.  */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
-   This must be initialized on some systems to avoid linking in the
-   system's own getopt implementation.  */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
-   If the caller did not specify anything,
-   the default is REQUIRE_ORDER if the environment variable
-   POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
-   REQUIRE_ORDER means don't recognize them as options;
-   stop option processing when the first non-option is seen.
-   This is what Unix does.
-   This mode of operation is selected by either setting the environment
-   variable POSIXLY_CORRECT, or using `+' as the first character
-   of the list of option characters.
-
-   PERMUTE is the default.  We permute the contents of ARGV as we scan,
-   so that eventually all the non-options are at the end.  This allows options
-   to be given in any order, even with programs that were not written to
-   expect this.
-
-   RETURN_IN_ORDER is an option available to programs that were written
-   to expect options and other ARGV-elements in any order and that care about
-   the ordering of the two.  We describe each non-option ARGV-element
-   as if it were the argument of an option with character code 1.
-   Using `-' as the first character of the list of option characters
-   selects this mode of operation.
-
-   The special argument `--' forces an end of option-scanning regardless
-   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
-   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
-
-static enum
-{
-  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Value of POSIXLY_CORRECT environment variable.  */
-static char *posixly_correct;
-
-#ifdef	__GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
-   because there are many ways it can cause trouble.
-   On some systems, it contains special magic macros that don't work
-   in GCC.  */
-# include <string.h>
-# define my_index	strchr
-#else
-
-# if HAVE_STRING_H
-#  include <string.h>
-# else
-#  include <strings.h>
-# endif
-
-/* Avoid depending on library functions or files
-   whose names are inconsistent.  */
-
-#ifndef getenv
-extern char *getenv ();
-#endif
-
-static char *
-my_index (str, chr)
-     const char *str;
-     int chr;
-{
-  while (*str)
-    {
-      if (*str == chr)
-	return (char *) str;
-      str++;
-    }
-  return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
-   If not using GCC, it is ok not to declare it.  */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
-   That was relevant to code that was here before.  */
-# if (!defined __STDC__ || !__STDC__) && !defined strlen
-/* gcc with -traditional declares the built-in strlen to return int,
-   and has done so at least since version 2.4.5. -- rms.  */
-extern int strlen (const char *);
-# endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
-#endif /* not __GNU_LIBRARY__ */
-
-/* Handle permutation of arguments.  */
-
-/* Describe the part of ARGV that contains non-options that have
-   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
-   `last_nonopt' is the index after the last of them.  */
-
-static int first_nonopt;
-static int last_nonopt;
-
-#ifdef _LIBC
-/* Stored original parameters.
-   XXX This is no good solution.  We should rather copy the args so
-   that we can compare them later.  But we must not use malloc(3).  */
-extern int __libc_argc;
-extern char **__libc_argv;
-
-/* Bash 2.0 gives us an environment variable containing flags
-   indicating ARGV elements that should not be considered arguments.  */
-
-# ifdef USE_NONOPTION_FLAGS
-/* Defined in getopt_init.c  */
-extern char *__getopt_nonoption_flags;
-
-static int nonoption_flags_max_len;
-static int nonoption_flags_len;
-# endif
-
-# ifdef USE_NONOPTION_FLAGS
-#  define SWAP_FLAGS(ch1, ch2) \
-  if (nonoption_flags_len > 0)						      \
-    {									      \
-      char __tmp = __getopt_nonoption_flags[ch1];			      \
-      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];	      \
-      __getopt_nonoption_flags[ch2] = __tmp;				      \
-    }
-# else
-#  define SWAP_FLAGS(ch1, ch2)
-# endif
-#else	/* !_LIBC */
-# define SWAP_FLAGS(ch1, ch2)
-#endif	/* _LIBC */
-
-/* Exchange two adjacent subsequences of ARGV.
-   One subsequence is elements [first_nonopt,last_nonopt)
-   which contains all the non-options that have been skipped so far.
-   The other is elements [last_nonopt,optind), which contains all
-   the options processed since those non-options were skipped.
-
-   `first_nonopt' and `last_nonopt' are relocated so that they describe
-   the new indices of the non-options in ARGV after they are moved.  */
-
-#if defined __STDC__ && __STDC__
-static void exchange (char **);
-#endif
-
-static void
-exchange (argv)
-     char **argv;
-{
-  int bottom = first_nonopt;
-  int middle = last_nonopt;
-  int top = optind;
-  char *tem;
-
-  /* Exchange the shorter segment with the far end of the longer segment.
-     That puts the shorter segment into the right place.
-     It leaves the longer segment in the right place overall,
-     but it consists of two parts that need to be swapped next.  */
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-  /* First make sure the handling of the `__getopt_nonoption_flags'
-     string can work normally.  Our top argument must be in the range
-     of the string.  */
-  if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
-    {
-      /* We must extend the array.  The user plays games with us and
-	 presents new arguments.  */
-      char *new_str = malloc (top + 1);
-      if (new_str == NULL) {
-	nonoption_flags_len = nonoption_flags_max_len = 0;
-	log_oom(__FILE__, __LINE__, __CURRENT_FUNC__);
-	abort();
-      } else {
-	  memset (__mempcpy (new_str, __getopt_nonoption_flags,
-			     nonoption_flags_max_len),
-		  '\0', top + 1 - nonoption_flags_max_len);
-	  nonoption_flags_max_len = top + 1;
-	  __getopt_nonoption_flags = new_str;
-      }
-    }
-#endif
-
-  while (top > middle && middle > bottom)
-    {
-      if (top - middle > middle - bottom)
-	{
-	  /* Bottom segment is the short one.  */
-	  int len = middle - bottom;
-	  register int i;
-
-	  /* Swap it with the top part of the top segment.  */
-	  for (i = 0; i < len; i++)
-	    {
-	      tem = argv[bottom + i];
-	      argv[bottom + i] = argv[top - (middle - bottom) + i];
-	      argv[top - (middle - bottom) + i] = tem;
-	      SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
-	    }
-	  /* Exclude the moved bottom segment from further swapping.  */
-	  top -= len;
-	}
-      else
-	{
-	  /* Top segment is the short one.  */
-	  int len = top - middle;
-	  register int i;
-
-	  /* Swap it with the bottom part of the bottom segment.  */
-	  for (i = 0; i < len; i++)
-	    {
-	      tem = argv[bottom + i];
-	      argv[bottom + i] = argv[middle + i];
-	      argv[middle + i] = tem;
-	      SWAP_FLAGS (bottom + i, middle + i);
-	    }
-	  /* Exclude the moved top segment from further swapping.  */
-	  bottom += len;
-	}
-    }
-
-  /* Update records for the slots the non-options now occupy.  */
-
-  first_nonopt += (optind - last_nonopt);
-  last_nonopt = optind;
-}
-
-/* Initialize the internal data when the first call is made.  */
-
-#if defined __STDC__ && __STDC__
-static const char *_getopt_initialize (int, char *const *, const char *);
-#endif
-static const char *
-_getopt_initialize (argc, argv, optstring)
-     int argc;
-     char *const *argv;
-     const char *optstring;
-{
-  /* Start processing options with ARGV-element 1 (since ARGV-element 0
-     is the program name); the sequence of previously skipped
-     non-option ARGV-elements is empty.  */
-
-  first_nonopt = last_nonopt = optind;
-
-  nextchar = NULL;
-
-  posixly_correct = getenv ("POSIXLY_CORRECT");
-
-  /* Determine how to handle the ordering of options and nonoptions.  */
-
-  if (optstring[0] == '-')
-    {
-      ordering = RETURN_IN_ORDER;
-      ++optstring;
-    }
-  else if (optstring[0] == '+')
-    {
-      ordering = REQUIRE_ORDER;
-      ++optstring;
-    }
-  else if (posixly_correct != NULL)
-    ordering = REQUIRE_ORDER;
-  else
-    ordering = PERMUTE;
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-  if (posixly_correct == NULL
-      && argc == __libc_argc && argv == __libc_argv)
-    {
-      if (nonoption_flags_max_len == 0)
-	{
-	  if (__getopt_nonoption_flags == NULL
-	      || __getopt_nonoption_flags[0] == '\0')
-	    nonoption_flags_max_len = -1;
-	  else
-	    {
-	      const char *orig_str = __getopt_nonoption_flags;
-	      int len = nonoption_flags_max_len = strlen (orig_str);
-	      if (nonoption_flags_max_len < argc)
-		nonoption_flags_max_len = argc;
-	      __getopt_nonoption_flags =
-		(char *) malloc (nonoption_flags_max_len);
-	      if (__getopt_nonoption_flags == NULL) {
-		log_oom(__FILE__, __LINE__, __CURRENT_FUNC__);
-		abort();
-		nonoption_flags_max_len = -1;
-	      } else {
-		memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
-			'\0', nonoption_flags_max_len - len);
-	      }
-	    }
-	}
-      nonoption_flags_len = nonoption_flags_max_len;
-    }
-  else
-    nonoption_flags_len = 0;
-#endif
-
-  return optstring;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
-   given in OPTSTRING.
-
-   If an element of ARGV starts with '-', and is not exactly "-" or "--",
-   then it is an option element.  The characters of this element
-   (aside from the initial '-') are option characters.  If `getopt'
-   is called repeatedly, it returns successively each of the option characters
-   from each of the option elements.
-
-   If `getopt' finds another option character, it returns that character,
-   updating `optind' and `nextchar' so that the next call to `getopt' can
-   resume the scan with the following option character or ARGV-element.
-
-   If there are no more option characters, `getopt' returns -1.
-   Then `optind' is the index in ARGV of the first ARGV-element
-   that is not an option.  (The ARGV-elements have been permuted
-   so that those that are not options now come last.)
-
-   OPTSTRING is a string containing the legitimate option characters.
-   If an option character is seen that is not listed in OPTSTRING,
-   return '?' after printing an error message.  If you set `opterr' to
-   zero, the error message is suppressed but we still return '?'.
-
-   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
-   so the following text in the same ARGV-element, or the text of the following
-   ARGV-element, is returned in `optarg'.  Two colons mean an option that
-   wants an optional arg; if there is text in the current ARGV-element,
-   it is returned in `optarg', otherwise `optarg' is set to zero.
-
-   If OPTSTRING starts with `-' or `+', it requests different methods of
-   handling the non-option ARGV-elements.
-   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
-   Long-named options begin with `--' instead of `-'.
-   Their names may be abbreviated as long as the abbreviation is unique
-   or is an exact match for some defined option.  If they have an
-   argument, it follows the option name in the same ARGV-element, separated
-   from the option name by a `=', or else the in next ARGV-element.
-   When `getopt' finds a long-named option, it returns 0 if that option's
-   `flag' field is nonzero, the value of the option's `val' field
-   if the `flag' field is zero.
-
-   The elements of ARGV aren't really const, because we permute them.
-   But we pretend they're const in the prototype to be compatible
-   with other systems.
-
-   LONGOPTS is a vector of `struct option' terminated by an
-   element containing a name which is zero.
-
-   LONGIND returns the index in LONGOPT of the long-named option found.
-   It is only valid when a long-named option has been found by the most
-   recent call.
-
-   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
-   long-named options.  */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
-     int argc;
-     char *const *argv;
-     const char *optstring;
-     const struct option *longopts;
-     int *longind;
-     int long_only;
-{
-  int print_errors = opterr;
-  if (optstring[0] == ':')
-    print_errors = 0;
-
-  if (argc < 1)
-    return -1;
-
-  optarg = NULL;
-
-  if (optind == 0 || !__getopt_initialized)
-    {
-      if (optind == 0)
-	optind = 1;	/* Don't scan ARGV[0], the program name.  */
-      optstring = _getopt_initialize (argc, argv, optstring);
-      __getopt_initialized = 1;
-    }
-
-  /* Test whether ARGV[optind] points to a non-option argument.
-     Either it does not have option syntax, or there is an environment flag
-     from the shell indicating it is not an option.  The later information
-     is only used when the used in the GNU libc.  */
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'	      \
-		      || (optind < nonoption_flags_len			      \
-			  && __getopt_nonoption_flags[optind] == '1'))
-#else
-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
-#endif
-
-  if (nextchar == NULL || *nextchar == '\0')
-    {
-      /* Advance to the next ARGV-element.  */
-
-      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
-	 moved back by the user (who may also have changed the arguments).  */
-      if (last_nonopt > optind)
-	last_nonopt = optind;
-      if (first_nonopt > optind)
-	first_nonopt = optind;
-
-      if (ordering == PERMUTE)
-	{
-	  /* If we have just processed some options following some non-options,
-	     exchange them so that the options come first.  */
-
-	  if (first_nonopt != last_nonopt && last_nonopt != optind)
-	    exchange ((char **) argv);
-	  else if (last_nonopt != optind)
-	    first_nonopt = optind;
-
-	  /* Skip any additional non-options
-	     and extend the range of non-options previously skipped.  */
-
-	  while (optind < argc && NONOPTION_P)
-	    optind++;
-	  last_nonopt = optind;
-	}
-
-      /* The special ARGV-element `--' means premature end of options.
-	 Skip it like a null option,
-	 then exchange with previous non-options as if it were an option,
-	 then skip everything else like a non-option.  */
-
-      if (optind != argc && !xstrcmp (argv[optind], "--"))
-	{
-	  optind++;
-
-	  if (first_nonopt != last_nonopt && last_nonopt != optind)
-	    exchange ((char **) argv);
-	  else if (first_nonopt == last_nonopt)
-	    first_nonopt = optind;
-	  last_nonopt = argc;
-
-	  optind = argc;
-	}
-
-      /* If we have done all the ARGV-elements, stop the scan
-	 and back over any non-options that we skipped and permuted.  */
-
-      if (optind == argc)
-	{
-	  /* Set the next-arg-index to point at the non-options
-	     that we previously skipped, so the caller will digest them.  */
-	  if (first_nonopt != last_nonopt)
-	    optind = first_nonopt;
-	  return -1;
-	}
-
-      /* If we have come to a non-option and did not permute it,
-	 either stop the scan or describe it to the caller and pass it by.  */
-
-      if (NONOPTION_P)
-	{
-	  if (ordering == REQUIRE_ORDER)
-	    return -1;
-	  optarg = argv[optind++];
-	  return 1;
-	}
-
-      /* We have found another option-ARGV-element.
-	 Skip the initial punctuation.  */
-
-      nextchar = (argv[optind] + 1
-		  + (longopts != NULL && argv[optind][1] == '-'));
-    }
-
-  /* Decode the current option-ARGV-element.  */
-
-  /* Check whether the ARGV-element is a long option.
-
-     If long_only and the ARGV-element has the form "-f", where f is
-     a valid short option, don't consider it an abbreviated form of
-     a long option that starts with f.  Otherwise there would be no
-     way to give the -f short option.
-
-     On the other hand, if there's a long option "fubar" and
-     the ARGV-element is "-fu", do consider that an abbreviation of
-     the long option, just like "--fu", and not "-f" with arg "u".
-
-     This distinction seems to be the most useful approach.  */
-
-  if (longopts != NULL
-      && (argv[optind][1] == '-'
-	  || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
-    {
-      char *nameend;
-      const struct option *p;
-      const struct option *pfound = NULL;
-      int exact = 0;
-      int ambig = 0;
-      int indfound = -1;
-      int option_index;
-
-      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
-	/* Do nothing.  */ ;
-
-      /* Test all long options for either exact match
-	 or abbreviated matches.  */
-      for (p = longopts, option_index = 0; p->name; p++, option_index++)
-	if (!xstrncmp (p->name, nextchar, nameend - nextchar))
-	  {
-	    if ((unsigned int) (nameend - nextchar)
-		== (unsigned int) strlen (p->name))
-	      {
-		/* Exact match found.  */
-		pfound = p;
-		indfound = option_index;
-		exact = 1;
-		break;
-	      }
-	    else if (pfound == NULL)
-	      {
-		/* First nonexact match found.  */
-		pfound = p;
-		indfound = option_index;
-	      }
-	    else if (long_only
-		     || pfound->has_arg != p->has_arg
-		     || pfound->flag != p->flag
-		     || pfound->val != p->val)
-	      /* Second or later nonexact match found.  */
-	      ambig = 1;
-	  }
-
-      if (ambig && !exact)
-	{
-	  if (print_errors)
-	    fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
-		     argv[0], argv[optind]);
-	  nextchar += strlen (nextchar);
-	  optind++;
-	  optopt = 0;
-	  return '?';
-	}
-
-      if (pfound != NULL)
-	{
-	  option_index = indfound;
-	  optind++;
-	  if (*nameend)
-	    {
-	      /* Don't test has_arg with >, because some C compilers don't
-		 allow it to be used on enums.  */
-	      if (pfound->has_arg)
-		optarg = nameend + 1;
-	      else
-		{
-		  if (print_errors)
-		    {
-		      if (argv[optind - 1][1] == '-')
-			/* --option */
-			fprintf (stderr,
-				 _("%s: option `--%s' doesn't allow an argument\n"),
-				 argv[0], pfound->name);
-		      else
-			/* +option or -option */
-			fprintf (stderr,
-				 _("%s: option `%c%s' doesn't allow an argument\n"),
-				 argv[0], argv[optind - 1][0], pfound->name);
-		    }
-
-		  nextchar += strlen (nextchar);
-
-		  optopt = pfound->val;
-		  return '?';
-		}
-	    }
-	  else if (pfound->has_arg == 1)
-	    {
-	      if (optind < argc)
-		optarg = argv[optind++];
-	      else
-		{
-		  if (print_errors)
-		    fprintf (stderr,
-			   _("%s: option `%s' requires an argument\n"),
-			   argv[0], argv[optind - 1]);
-		  nextchar += strlen (nextchar);
-		  optopt = pfound->val;
-		  return optstring[0] == ':' ? ':' : '?';
-		}
-	    }
-	  nextchar += strlen (nextchar);
-	  if (longind != NULL)
-	    *longind = option_index;
-	  if (pfound->flag)
-	    {
-	      *(pfound->flag) = pfound->val;
-	      return 0;
-	    }
-	  return pfound->val;
-	}
-
-      /* Can't find it as a long option.  If this is not getopt_long_only,
-	 or the option starts with '--' or is not a valid short
-	 option, then it's an error.
-	 Otherwise interpret it as a short option.  */
-      if (!long_only || argv[optind][1] == '-'
-	  || my_index (optstring, *nextchar) == NULL)
-	{
-	  if (print_errors)
-	    {
-	      if (argv[optind][1] == '-')
-		/* --option */
-		fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
-			 argv[0], nextchar);
-	      else
-		/* +option or -option */
-		fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
-			 argv[0], argv[optind][0], nextchar);
-	    }
-	  nextchar = (char *) "";
-	  optind++;
-	  optopt = 0;
-	  return '?';
-	}
-    }
-
-  /* Look at and handle the next short option-character.  */
-
-  {
-    char c = *nextchar++;
-    char *temp = my_index (optstring, c);
-
-    /* Increment `optind' when we start to process its last character.  */
-    if (*nextchar == '\0')
-      ++optind;
-
-    if (temp == NULL || c == ':')
-      {
-	if (print_errors)
-	  {
-	    if (posixly_correct)
-	      /* 1003.2 specifies the format of this message.  */
-	      fprintf (stderr, _("%s: illegal option -- %c\n"),
-		       argv[0], c);
-	    else
-	      fprintf (stderr, _("%s: invalid option -- %c\n"),
-		       argv[0], c);
-	  }
-	optopt = c;
-	return '?';
-      }
-    /* Convenience. Treat POSIX -W foo same as long option --foo */
-    if (temp[0] == 'W' && temp[1] == ';')
-      {
-	char *nameend;
-	const struct option *p;
-	const struct option *pfound = NULL;
-	int exact = 0;
-	int ambig = 0;
-	int indfound = 0;
-	int option_index;
-
-	/* This is an option that requires an argument.  */
-	if (*nextchar != '\0')
-	  {
-	    optarg = nextchar;
-	    /* If we end this ARGV-element by taking the rest as an arg,
-	       we must advance to the next element now.  */
-	    optind++;
-	  }
-	else if (optind == argc)
-	  {
-	    if (print_errors)
-	      {
-		/* 1003.2 specifies the format of this message.  */
-		fprintf (stderr, _("%s: option requires an argument -- %c\n"),
-			 argv[0], c);
-	      }
-	    optopt = c;
-	    if (optstring[0] == ':')
-	      c = ':';
-	    else
-	      c = '?';
-	    return c;
-	  }
-	else
-	  /* We already incremented `optind' once;
-	     increment it again when taking next ARGV-elt as argument.  */
-	  optarg = argv[optind++];
-
-	/* optarg is now the argument, see if it's in the
-	   table of longopts.  */
-
-	for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
-	  /* Do nothing.  */ ;
-
-	/* Test all long options for either exact match
-	   or abbreviated matches.  */
-	for (p = longopts, option_index = 0; p->name; p++, option_index++)
-	  if (!xstrncmp (p->name, nextchar, nameend - nextchar))
-	    {
-	      if ((unsigned int) (nameend - nextchar) == strlen (p->name))
-		{
-		  /* Exact match found.  */
-		  pfound = p;
-		  indfound = option_index;
-		  exact = 1;
-		  break;
-		}
-	      else if (pfound == NULL)
-		{
-		  /* First nonexact match found.  */
-		  pfound = p;
-		  indfound = option_index;
-		}
-	      else
-		/* Second or later nonexact match found.  */
-		ambig = 1;
-	    }
-	if (ambig && !exact)
-	  {
-	    if (print_errors)
-	      fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
-		       argv[0], argv[optind]);
-	    nextchar += strlen (nextchar);
-	    optind++;
-	    return '?';
-	  }
-	if (pfound != NULL)
-	  {
-	    option_index = indfound;
-	    if (*nameend)
-	      {
-		/* Don't test has_arg with >, because some C compilers don't
-		   allow it to be used on enums.  */
-		if (pfound->has_arg)
-		  optarg = nameend + 1;
-		else
-		  {
-		    if (print_errors)
-		      fprintf (stderr, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
-			       argv[0], pfound->name);
-
-		    nextchar += strlen (nextchar);
-		    return '?';
-		  }
-	      }
-	    else if (pfound->has_arg == 1)
-	      {
-		if (optind < argc)
-		  optarg = argv[optind++];
-		else
-		  {
-		    if (print_errors)
-		      fprintf (stderr,
-			       _("%s: option `%s' requires an argument\n"),
-			       argv[0], argv[optind - 1]);
-		    nextchar += strlen (nextchar);
-		    return optstring[0] == ':' ? ':' : '?';
-		  }
-	      }
-	    nextchar += strlen (nextchar);
-	    if (longind != NULL)
-	      *longind = option_index;
-	    if (pfound->flag)
-	      {
-		*(pfound->flag) = pfound->val;
-		return 0;
-	      }
-	    return pfound->val;
-	  }
-	  nextchar = NULL;
-	  return 'W';	/* Let the application handle it.   */
-      }
-    if (temp[1] == ':')
-      {
-	if (temp[2] == ':')
-	  {
-	    /* This is an option that accepts an argument optionally.  */
-	    if (*nextchar != '\0')
-	      {
-		optarg = nextchar;
-		optind++;
-	      }
-	    else
-	      optarg = NULL;
-	    nextchar = NULL;
-	  }
-	else
-	  {
-	    /* This is an option that requires an argument.  */
-	    if (*nextchar != '\0')
-	      {
-		optarg = nextchar;
-		/* If we end this ARGV-element by taking the rest as an arg,
-		   we must advance to the next element now.  */
-		optind++;
-	      }
-	    else if (optind == argc)
-	      {
-		if (print_errors)
-		  {
-		    /* 1003.2 specifies the format of this message.  */
-		    fprintf (stderr,
-			     _("%s: option requires an argument -- %c\n"),
-			     argv[0], c);
-		  }
-		optopt = c;
-		if (optstring[0] == ':')
-		  c = ':';
-		else
-		  c = '?';
-	      }
-	    else
-	      /* We already incremented `optind' once;
-		 increment it again when taking next ARGV-elt as argument.  */
-	      optarg = argv[optind++];
-	    nextchar = NULL;
-	  }
-      }
-    return c;
-  }
-}
-
-int
-getopt (argc, argv, optstring)
-     int argc;
-     char *const *argv;
-     const char *optstring;
-{
-  return _getopt_internal (argc, argv, optstring,
-			   (const struct option *) 0,
-			   (int *) 0,
-			   0);
-}
-
-#endif	/* Not ELIDE_CODE.  */
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
-   the above definition of `getopt'.  */
-
-int
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-
-      c = getopt (argc, argv, "abc:d:0123456789");
-      if (c == -1)
-	break;
-
-      switch (c)
-	{
-	case '0':
-	case '1':
-	case '2':
-	case '3':
-	case '4':
-	case '5':
-	case '6':
-	case '7':
-	case '8':
-	case '9':
-	  if (digit_optind != 0 && digit_optind != this_option_optind)
-	    printf ("digits occur in two different argv-elements.\n");
-	  digit_optind = this_option_optind;
-	  printf ("option %c\n", c);
-	  break;
-
-	case 'a':
-	  printf ("option a\n");
-	  break;
-
-	case 'b':
-	  printf ("option b\n");
-	  break;
-
-	case 'c':
-	  printf ("option c with value `%s'\n", optarg);
-	  break;
-
-	case '?':
-	  break;
-
-	default:
-	  printf ("?? getopt returned character code 0%o ??\n", c);
-	}
-    }
-
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-	printf ("%s ", argv[optind++]);
-      printf ("\n");
-    }
-
-  exit (0);
-}
-
-#endif /* TEST */
diff --git a/src/common/getopt.h b/src/common/getopt.h
deleted file mode 100644
index d0694bd3ee50bd98bb7cb2cc940c8db962e58c4c..0000000000000000000000000000000000000000
--- a/src/common/getopt.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301 USA.  */
-
-#ifndef _GETOPT_H
-
-#ifndef __need_getopt
-# define _GETOPT_H 1
-#endif
-
-/* If __GNU_LIBRARY__ is not already defined, either we are being used
-   standalone, or this is the first header included in the source file.
-   If we are being used with glibc, we need to include <features.h>, but
-   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
-   not defined, include <ctype.h>, which will pull in <features.h> for us
-   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
-   doesn't flood the namespace with stuff the way some other headers do.)  */
-#if !defined __GNU_LIBRARY__
-# include <ctype.h>
-#endif
-
-#ifdef	__cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
-   the argument value is returned here.
-   Also, when `ordering' is RETURN_IN_ORDER,
-   each non-option ARGV-element is returned here.  */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
-   This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
-
-   On entry to `getopt', zero means this is the first call; initialize.
-
-   When `getopt' returns -1, this is the index of the first of the
-   non-option elements that the caller should itself scan.
-
-   Otherwise, `optind' communicates from one call to the next
-   how much of ARGV has been scanned so far.  */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
-   for unrecognized options.  */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized.  */
-
-extern int optopt;
-
-#ifndef __need_getopt
-/* Describe the long-named options requested by the application.
-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
-   of `struct option' terminated by an element containing a name which is
-   zero.
-
-   The field `has_arg' is:
-   no_argument		(or 0) if the option does not take an argument,
-   required_argument	(or 1) if the option requires an argument,
-   optional_argument 	(or 2) if the option takes an optional argument.
-
-   If the field `flag' is not NULL, it points to a variable that is set
-   to the value given in the field `val' when the option is found, but
-   left unchanged if the option is not found.
-
-   To have a long-named option do something other than set an `int' to
-   a compiled-in constant, such as set a value from `optarg', set the
-   option's `flag' field to zero and its `val' field to a nonzero
-   value (the equivalent single-letter option character, if there is
-   one).  For long options that have a zero `flag' field, `getopt'
-   returns the contents of the `val' field.  */
-
-struct option
-{
-# if (defined __STDC__ && __STDC__) || defined __cplusplus
-  const char *name;
-# else
-  char *name;
-# endif
-  /* has_arg can't be an enum because some compilers complain about
-     type mismatches in all the code that assumes it is an int.  */
-  int has_arg;
-  int *flag;
-  int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'.  */
-
-# define no_argument		0
-# define required_argument	1
-# define optional_argument	2
-#endif	/* need getopt */
-
-
-/* Get definitions and prototypes for functions to process the
-   arguments in ARGV (ARGC of them, minus the program name) for
-   options given in OPTS.
-
-   Return the option character from OPTS just read.  Return -1 when
-   there are no more options.  For unrecognized options, or options
-   missing arguments, `optopt' is set to the option letter, and '?' is
-   returned.
-
-   The OPTS string is a list of characters which are recognized option
-   letters, optionally followed by colons, specifying that that letter
-   takes an argument, to be placed in `optarg'.
-
-   If a letter in OPTS is followed by two colons, its argument is
-   optional.  This behavior is specific to the GNU `getopt'.
-
-   The argument `--' causes premature termination of argument
-   scanning, explicitly telling `getopt' that there are no more
-   options.
-
-   If OPTS begins with `--', then non-option arguments are treated as
-   arguments to the option '\0'.  This behavior is specific to the GNU
-   `getopt'.  */
-
-#if (defined __STDC__ && __STDC__) || defined __cplusplus
-# ifdef __GNU_LIBRARY__
-/* Many other libraries have conflicting prototypes for getopt, with
-   differences in the consts, in stdlib.h.  To avoid compilation
-   errors, only prototype getopt for the GNU C library.  */
-extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
-# else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-# endif /* __GNU_LIBRARY__ */
-
-# ifndef __need_getopt
-extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
-		        const struct option *__longopts, int *__longind);
-extern int getopt_long_only (int __argc, char *const *__argv,
-			     const char *__shortopts,
-		             const struct option *__longopts, int *__longind);
-
-/* Internal only.  Users should not call this directly.  */
-extern int _getopt_internal (int __argc, char *const *__argv,
-			     const char *__shortopts,
-		             const struct option *__longopts, int *__longind,
-			     int __long_only);
-# endif
-#else /* not __STDC__ */
-extern int getopt ();
-# ifndef __need_getopt
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-# endif
-#endif /* __STDC__ */
-
-#ifdef	__cplusplus
-}
-#endif
-
-/* Make sure we later can get all the definitions and declarations.  */
-#undef __need_getopt
-
-#endif /* getopt.h */
diff --git a/src/common/getopt1.c b/src/common/getopt1.c
deleted file mode 100644
index 08952725003873cdd85445ec46e9e520d3e4f095..0000000000000000000000000000000000000000
--- a/src/common/getopt1.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
-     Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301 USA.  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "getopt.h"
-
-#if !defined __STDC__ || !__STDC__
-/* This is a separate conditional since some stdc systems
-   reject `defined (const)'.  */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself.  This code is part of the GNU C
-   Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object files,
-   it is simpler to just do this in the source for each such file.  */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#endif
-
-#ifndef	NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
-{
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
-   If an option that starts with '-' (not '--') doesn't match a long option,
-   but does match a short option, it is parsed as a short option
-   instead.  */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
-{
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif	/* Not ELIDE_CODE.  */
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-      int option_index = 0;
-      static struct option long_options[] =
-      {
-	{"add", 1, 0, 0},
-	{"append", 0, 0, 0},
-	{"delete", 1, 0, 0},
-	{"verbose", 0, 0, 0},
-	{"create", 0, 0, 0},
-	{"file", 1, 0, 0},
-	{0, 0, 0, 0}
-      };
-
-      c = getopt_long (argc, argv, "abc:d:0123456789",
-		       long_options, &option_index);
-      if (c == -1)
-	break;
-
-      switch (c)
-	{
-	case 0:
-	  printf ("option %s", long_options[option_index].name);
-	  if (optarg)
-	    printf (" with arg %s", optarg);
-	  printf ("\n");
-	  break;
-
-	case '0':
-	case '1':
-	case '2':
-	case '3':
-	case '4':
-	case '5':
-	case '6':
-	case '7':
-	case '8':
-	case '9':
-	  if (digit_optind != 0 && digit_optind != this_option_optind)
-	    printf ("digits occur in two different argv-elements.\n");
-	  digit_optind = this_option_optind;
-	  printf ("option %c\n", c);
-	  break;
-
-	case 'a':
-	  printf ("option a\n");
-	  break;
-
-	case 'b':
-	  printf ("option b\n");
-	  break;
-
-	case 'c':
-	  printf ("option c with value `%s'\n", optarg);
-	  break;
-
-	case 'd':
-	  printf ("option d with value `%s'\n", optarg);
-	  break;
-
-	case '?':
-	  break;
-
-	default:
-	  printf ("?? getopt returned character code 0%o ??\n", c);
-	}
-    }
-
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-	printf ("%s ", argv[optind++]);
-      printf ("\n");
-    }
-
-  exit (0);
-}
-
-#endif /* TEST */
diff --git a/src/common/gres.c b/src/common/gres.c
index 9bb5b1f6e9bec4026aa36634b274cf4c16bb2f60..d71f30390f4abbda4abbe29e1e7d951974e13322 100644
--- a/src/common/gres.c
+++ b/src/common/gres.c
@@ -40,44 +40,23 @@
 #define _GNU_SOURCE
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#  ifdef HAVE_LIMITS_H
-#    include <limits.h>
-#  endif
-#else /* ! HAVE_CONFIG_H */
-#  include <limits.h>
-#  include <sys/types.h>
-#  include <stdint.h>
-#  include <stdlib.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
 #ifdef __FreeBSD__
-#include <sys/param.h>
-#include <sys/cpuset.h>
+#  include <sys/param.h>
+#  include <sys/cpuset.h>
 typedef cpuset_t cpu_set_t;
 #endif
 
 #include <ctype.h>
+#include <inttypes.h>
+#include <limits.h>
 #include <sched.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <math.h>
 
 #include "slurm/slurm.h"
diff --git a/src/common/hostlist.c b/src/common/hostlist.c
index 5cd0cc43b003c00f9594e3aca27c5f140717af40..f2894a6d4c75ea7abb5a59c5bfd61a4f16c75f1d 100644
--- a/src/common/hostlist.c
+++ b/src/common/hostlist.c
@@ -38,33 +38,20 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#  if HAVE_STRING_H
-#    include <string.h>
-#  endif
-#  if HAVE_PTHREAD_H
-#    include <pthread.h>
-#  endif
-#else                /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#  include <string.h>
-#  include <pthread.h>
-#endif                /* HAVE_CONFIG_H */
+#endif
 
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#include <assert.h>
-#include <errno.h>
-#include <ctype.h>
+#include <string.h>
 #include <sys/param.h>
 #include <unistd.h>
+
 #include <slurm/slurmdb.h>
 
 #include "src/common/bitstring.h"
diff --git a/src/common/io_hdr.h b/src/common/io_hdr.h
index af924c17fb878145b2cc6aedc31c57ed9f9b3056..75b547be0ac0fdda5cfc9872d92cf4d540bd6f64 100644
--- a/src/common/io_hdr.h
+++ b/src/common/io_hdr.h
@@ -39,17 +39,11 @@
 #ifndef _HAVE_IO_HDR_H
 #define _HAVE_IO_HDR_H
 
-
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
+#include <inttypes.h>
 
 #include "src/common/macros.h"   /* Containes SLURM_CRED_SIGLEN */
 #include "src/common/pack.h"
diff --git a/src/common/job_resources.h b/src/common/job_resources.h
index 318ec5b4a4cd0f81957cff809a5eb3330d2f6371..170bd28e95b63317e3690a19d7de742ffd3a3f06 100644
--- a/src/common/job_resources.h
+++ b/src/common/job_resources.h
@@ -41,15 +41,10 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
+#include <inttypes.h>
+
 #include "src/common/bitstring.h"
 #include "src/common/pack.h"
 #include "src/slurmctld/slurmctld.h"
diff --git a/src/common/layouts_mgr.c b/src/common/layouts_mgr.c
index 56e38a8b3e36222e20a7c54a7b7a4a8577e1e341..886f4adc2e54e9530c864c7b88c7be06a76c0409 100644
--- a/src/common/layouts_mgr.c
+++ b/src/common/layouts_mgr.c
@@ -36,19 +36,17 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
+#include <ctype.h>
 #include <pthread.h>
 #include <string.h>
-#include <strings.h>
-#include <ctype.h>
 #include <sys/stat.h>
 
 #include "layouts_mgr.h"
 
-#include "src/common/entity.h"
-#include "src/common/layout.h"
-
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
+#include "src/common/entity.h"
+#include "src/common/layout.h"
 #include "src/common/hostlist.h"
 #include "src/common/list.h"
 #include "src/common/node_conf.h"
diff --git a/src/common/macros.h b/src/common/macros.h
index cc9644a6c00b5cbb8d150d5f579f425af86a463b..67e8e5e3240f8e439722f41a00e9c02009c5d1ea 100644
--- a/src/common/macros.h
+++ b/src/common/macros.h
@@ -55,12 +55,10 @@
 #  endif
 #endif /* !HAVE_STDBOOL_H */
 
-#if HAVE_PTHREAD_H
-#  include <pthread.h>
-#endif
-
 #include <errno.h>              /* for errno   */
+#include <pthread.h>
 #include <stdlib.h>		/* for abort() */
+
 #include "src/common/log.h"	/* for error() */
 
 #ifndef FALSE
diff --git a/src/common/node_conf.c b/src/common/node_conf.c
index 2937c6704d89e0265dee179e6002267c18012c85..e0b1d9464c806d25e8fd194e2a287440595767bd 100644
--- a/src/common/node_conf.c
+++ b/src/common/node_conf.c
@@ -45,24 +45,18 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
 #include <ctype.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
+#include <time.h>
 
 #include "src/common/hostlist.h"
 #include "src/common/macros.h"
diff --git a/src/common/node_conf.h b/src/common/node_conf.h
index ee9831678dcb654a663aae34ee1a15d094494bf6..771cb76d2d9637c08f9a9fe34bce4cdd065af231 100644
--- a/src/common/node_conf.h
+++ b/src/common/node_conf.h
@@ -44,15 +44,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
+#include <inttypes.h>
 #include <time.h>
 
 #include "src/common/bitstring.h"
diff --git a/src/common/node_features.c b/src/common/node_features.c
index 8750834acdd4247e6d628eb5fa140802bf759c66..7954a404934cb3b5ed8c71b0d2815ec5825d697b 100644
--- a/src/common/node_features.c
+++ b/src/common/node_features.c
@@ -37,28 +37,12 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "src/common/macros.h"
diff --git a/src/common/optz.h b/src/common/optz.h
index 377769088db57f417cf88c320df6908342b62af5..708ebdfefac7f42bd445d32f86d3471b68be6cf3 100644
--- a/src/common/optz.h
+++ b/src/common/optz.h
@@ -46,11 +46,7 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
+#include <getopt.h>
 
 struct option * optz_create (void);
 
diff --git a/src/common/pack.h b/src/common/pack.h
index 80cb2fd436bb1cc4ff51529ae717d64ec1254bdd..54413317451b34bfbcff53f4a09f16421a7bf45e 100644
--- a/src/common/pack.h
+++ b/src/common/pack.h
@@ -43,20 +43,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#include <stdint.h>
-#endif  /* HAVE_CONFIG_H */
+#endif
 
 #include <assert.h>
+#include <inttypes.h>
 #include <time.h>
 #include <string.h>
+
 #include "src/common/bitstring.h"
 
 #define BUF_MAGIC 0x42554545
diff --git a/src/common/parse_spec.h b/src/common/parse_spec.h
index 05518354f75dd016ce0027a9337b4527effb0e58..201527ffd4cf1238ad4f4bc0623526ae46e97a93 100644
--- a/src/common/parse_spec.h
+++ b/src/common/parse_spec.h
@@ -41,16 +41,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else	/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 /*
  * slurm_parser - parse the supplied specification into keyword/value pairs
diff --git a/src/common/parse_time.c b/src/common/parse_time.c
index 734dd1ac858ffd5ed160a46a71545dc3504beb0a..86db6286eaf280813289c6be088331c49b075b28 100644
--- a/src/common/parse_time.c
+++ b/src/common/parse_time.c
@@ -44,7 +44,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <time.h>
 
 #ifndef   __USE_ISOC99
diff --git a/src/common/parse_time.h b/src/common/parse_time.h
index b98c1df84be6e1b0e2905948544fea03fd4ab76c..775584179df6c9752dc544ac1e9897fb66093194 100644
--- a/src/common/parse_time.h
+++ b/src/common/parse_time.h
@@ -41,17 +41,10 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif                        /* HAVE_INTTYPES_H */
-#else                           /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
 #endif
 
+#include <inttypes.h>
+
 #include <time.h>
 
 /* Convert string to equivalent time value
diff --git a/src/common/parse_value.c b/src/common/parse_value.c
index 2d4b7006058cc18a68084f838602f0e447f3e31c..acee9ec33709231cdb1645f39c0c29b17b7414d8 100644
--- a/src/common/parse_value.c
+++ b/src/common/parse_value.c
@@ -43,7 +43,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <math.h>
 
diff --git a/src/common/plugin.h b/src/common/plugin.h
index a51f5d69d4bb293a75a5649fd0d824e1517772ea..2e1e57eee34eaafd411ccb2f8f5cbd7de1b4b6ec 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -41,19 +41,10 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif
-#else /* ! HAVE_CONFIG_H_ */
-#  include <inttypes.h>
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
+#include <sys/types.h>
 
 #include "slurm/slurm_errno.h"
 
diff --git a/src/common/plugstack.h b/src/common/plugstack.h
index bdbb363445c03aa042d53c185f3e552759050d11..9ba620c2f8584151fdd82aad8efdf188cf5b7592 100644
--- a/src/common/plugstack.h
+++ b/src/common/plugstack.h
@@ -46,11 +46,7 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
+#include <getopt.h>
 
 #include "src/common/job_options.h"
 #include "src/slurmd/slurmstepd/slurmstepd_job.h"
diff --git a/src/common/print_fields.h b/src/common/print_fields.h
index 85fb2503d792b8168264d4ac87f9f69124cd75f9..2feae07dccb6f0a72b1e25718a474a084266195b 100644
--- a/src/common/print_fields.h
+++ b/src/common/print_fields.h
@@ -43,22 +43,12 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
+#include <getopt.h>
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 
diff --git a/src/common/proc_args.c b/src/common/proc_args.c
index c8eb88c72eac648b5990173a97e71bd27f1c3fac..086ccfc5de083f9a1e11d2916896ba5398850a59 100644
--- a/src/common/proc_args.c
+++ b/src/common/proc_args.c
@@ -40,12 +40,6 @@
 #  include "config.h"
 #endif
 
-#include <string.h>		/* strcpy, strncasecmp */
-
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
-
 #ifndef __USE_ISOC99
 #define __USE_ISOC99
 #endif
@@ -62,18 +56,18 @@
 #  define SYSTEM_DIMENSIONS 1
 #endif
 
+#include <ctype.h>		/* isdigit    */
 #include <fcntl.h>
+#include <pwd.h>		/* getpwuid   */
 #include <stdarg.h>		/* va_start   */
 #include <stdio.h>
 #include <stdlib.h>		/* getenv, strtoll */
-#include <pwd.h>		/* getpwuid   */
-#include <ctype.h>		/* isdigit    */
+#include <string.h>		/* strcpy, strncasecmp */
 #include <sys/param.h>		/* MAXPATHLEN */
 #include <sys/stat.h>
-#include <unistd.h>
-#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "src/common/gres.h"
 #include "src/common/list.h"
diff --git a/src/common/slurm_acct_gather.h b/src/common/slurm_acct_gather.h
index e6533a92a0148523160a393270639f5b933e6b55..743a228ef84cd3ee606a5a1477b3b35864b443aa 100644
--- a/src/common/slurm_acct_gather.h
+++ b/src/common/slurm_acct_gather.h
@@ -40,16 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "read_config.h"
 #include "slurm_acct_gather_energy.h"
diff --git a/src/common/slurm_acct_gather_energy.h b/src/common/slurm_acct_gather_energy.h
index 3e6e6cfc7d1536432f06cf35884aaf0b61731266..d876ccaf01bcf699b1c21567c0f26b644eea56f0 100644
--- a/src/common/slurm_acct_gather_energy.h
+++ b/src/common/slurm_acct_gather_energy.h
@@ -40,17 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <time.h>
diff --git a/src/common/slurm_acct_gather_filesystem.h b/src/common/slurm_acct_gather_filesystem.h
index 593e768c1261cc142c76b88327feee0a2b5f8483..13d45cba4f5c0674dc4818f4247c2bdaffc7ec99 100644
--- a/src/common/slurm_acct_gather_filesystem.h
+++ b/src/common/slurm_acct_gather_filesystem.h
@@ -40,17 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <time.h>
diff --git a/src/common/slurm_acct_gather_infiniband.h b/src/common/slurm_acct_gather_infiniband.h
index 973fccd76ed18ed31981d055b794a632799bf902..85e0ed35babcb6d3a187224a711502456f48ca87 100644
--- a/src/common/slurm_acct_gather_infiniband.h
+++ b/src/common/slurm_acct_gather_infiniband.h
@@ -40,17 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <time.h>
diff --git a/src/common/slurm_acct_gather_profile.h b/src/common/slurm_acct_gather_profile.h
index f1c0c62ac7b43da0aa87965a3238a7eee308819b..48a8ef4118a0f66028d85caddf2e2e646335512f 100644
--- a/src/common/slurm_acct_gather_profile.h
+++ b/src/common/slurm_acct_gather_profile.h
@@ -41,17 +41,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <time.h>
diff --git a/src/common/slurm_auth.h b/src/common/slurm_auth.h
index eeaab391ef6da49882ec2a16e9745d91e0dd7fd1..00f0fa17f3714fc464e6e1410144a3cfaca2a992 100644
--- a/src/common/slurm_auth.h
+++ b/src/common/slurm_auth.h
@@ -43,16 +43,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "src/common/plugrack.h"
 #include "src/common/pack.h"
diff --git a/src/common/slurm_ext_sensors.h b/src/common/slurm_ext_sensors.h
index 4ddc8f9acb5a508aad6ff3a561cefcbf14714a1a..33136621d3298a6b393f297cedfb2e48848ac600 100644
--- a/src/common/slurm_ext_sensors.h
+++ b/src/common/slurm_ext_sensors.h
@@ -40,17 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <time.h>
diff --git a/src/common/slurm_jobacct_gather.h b/src/common/slurm_jobacct_gather.h
index 93696d1545d26439d21e8549389a81f24e29e8d9..163524797bcfea6fa834f8157ee99a60b047d72a 100644
--- a/src/common/slurm_jobacct_gather.h
+++ b/src/common/slurm_jobacct_gather.h
@@ -47,23 +47,14 @@
  *       Morris Jette, et al.
 \*****************************************************************************/
 
-
 #ifndef __SLURM_JOBACCT_GATHER_H__
 #define __SLURM_JOBACCT_GATHER_H__
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <time.h>
diff --git a/src/common/slurm_jobcomp.h b/src/common/slurm_jobcomp.h
index e0899327d8d24aa91d1032d4ba424d27d7a47ddf..f7155565394130234cbcc8a442c323a4de373b7c 100644
--- a/src/common/slurm_jobcomp.h
+++ b/src/common/slurm_jobcomp.h
@@ -43,12 +43,8 @@
 #if HAVE_CONFIG_H
 #  include "config.h"
 #endif
-#if HAVE_STDINT_H
-#  include <stdint.h>           /* for uint16_t, uint32_t definitions */
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>         /* for uint16_t, uint32_t definitions */
-#endif
+
+#include <inttypes.h>
 #include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
diff --git a/src/common/slurm_mcs.h b/src/common/slurm_mcs.h
index 4d6c6c7171674b71d61547a856ac6d063a623472..e4cfa610a27ed37fd57e570ecf65ed1381fc7cba 100644
--- a/src/common/slurm_mcs.h
+++ b/src/common/slurm_mcs.h
@@ -40,12 +40,8 @@
 #if HAVE_CONFIG_H
 #  include "config.h"
 #endif
-#if HAVE_STDINT_H
-#  include <stdint.h>           /* for uint16_t, uint32_t definitions */
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>         /* for uint16_t, uint32_t definitions */
-#endif
+
+#include <inttypes.h>
 
 #include "src/slurmctld/slurmctld.h"
 
diff --git a/src/common/slurm_priority.h b/src/common/slurm_priority.h
index 173e5166f7e119c24fcdd0db02a12a442f6678fe..3b786af2f1d722dac2ceac4c516e1dca0d4318d1 100644
--- a/src/common/slurm_priority.h
+++ b/src/common/slurm_priority.h
@@ -42,12 +42,8 @@
 #if HAVE_CONFIG_H
 #  include "config.h"
 #endif
-#if HAVE_STDINT_H
-#  include <stdint.h>           /* for uint16_t, uint32_t definitions */
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>         /* for uint16_t, uint32_t definitions */
-#endif
+
+#include <inttypes.h>
 
 #include "src/slurmctld/slurmctld.h"
 #include "src/common/slurm_accounting_storage.h"
diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h
index 971e36f4b0298ba6a27311e23157f7113f429818..bd8e164381d6d21c17ca0e784bea6de968ed547d 100644
--- a/src/common/slurm_protocol_api.h
+++ b/src/common/slurm_protocol_api.h
@@ -44,17 +44,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/types.h>
 #include <stdarg.h>
 
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index a03ad8ab7e86c368128e47c9c8ccac5d09e758d7..caeae1ade1947524e20d3ccad1ee32c586c1887d 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -43,17 +43,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <sys/wait.h>
 
 #include "slurm/slurm.h"
diff --git a/src/common/slurm_protocol_interface.h b/src/common/slurm_protocol_interface.h
index d646015c9cfcfdecca991997df32000ca8deef5b..244f71b8eb61679ca975facded74790d60b196e6 100644
--- a/src/common/slurm_protocol_interface.h
+++ b/src/common/slurm_protocol_interface.h
@@ -41,37 +41,18 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
-
-/* WHAT ABOUT THESE INCLUDES */
+#endif
+
+#include <fcntl.h>
+#include <inttypes.h>
 #include <netdb.h>
 #include <netinet/in.h>
+#include <stdarg.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
 #include <sys/time.h>
-
-
-#if HAVE_SYS_SOCKET_H
-#  include <sys/socket.h>
-#else
-#  if HAVE_SOCKET_H
-#    include <socket.h>
-#  endif
-#endif
-
-
 #include <sys/types.h>
-#include <sys/ioctl.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <stdarg.h>
 
 #include "src/common/macros.h"
 #include "src/common/pack.h"
diff --git a/src/common/slurm_protocol_pack.h b/src/common/slurm_protocol_pack.h
index e608cb19dd7be58697a18c7627cfe8f37a587a5e..012d38ff380db3fb68e1337812702efca3e3ed8e 100644
--- a/src/common/slurm_protocol_pack.h
+++ b/src/common/slurm_protocol_pack.h
@@ -42,16 +42,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "src/common/pack.h"
 #include "src/common/slurm_protocol_defs.h"
diff --git a/src/common/slurm_protocol_socket_common.h b/src/common/slurm_protocol_socket_common.h
index ebf74df833a46a45ed3ba6db83cf3a85df7ecfaf..0719e30ab22c2a0371d260ae5699359a494b4d02 100644
--- a/src/common/slurm_protocol_socket_common.h
+++ b/src/common/slurm_protocol_socket_common.h
@@ -42,17 +42,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <netinet/in.h>
 
 #define AF_SLURM AF_INET
diff --git a/src/common/slurm_protocol_util.h b/src/common/slurm_protocol_util.h
index 98965c72dc73bd6b97201487dee861b54d79794c..f9df1d9d09c5579749610afbac2f0b5ea3a927b6 100644
--- a/src/common/slurm_protocol_util.h
+++ b/src/common/slurm_protocol_util.h
@@ -41,17 +41,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
 
 #include "src/common/slurm_protocol_defs.h"
diff --git a/src/common/slurm_resource_info.h b/src/common/slurm_resource_info.h
index 20284678573a7a81f1d8ba532eef199d3ff4c891..1a3981a433f88b5238494e12e071c420f0e04946 100644
--- a/src/common/slurm_resource_info.h
+++ b/src/common/slurm_resource_info.h
@@ -40,15 +40,10 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
+#include <stdint.h>
+
 void slurm_print_cpu_bind_help(void);
 void slurm_print_mem_bind_help(void);
 
diff --git a/src/common/slurm_step_layout.h b/src/common/slurm_step_layout.h
index c3583209d51bfac7a8a363e6a96558d8bb6a5b96..27cd2fd4cb42c8750199b9854aedda1abb773847 100644
--- a/src/common/slurm_step_layout.h
+++ b/src/common/slurm_step_layout.h
@@ -33,15 +33,10 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
+#include <inttypes.h>
+
 #include "src/common/hostlist.h"
 #include "src/common/pack.h"
 
diff --git a/src/common/slurmdbd_defs.c b/src/common/slurmdbd_defs.c
index 64cc3a015d382ec8db1ebfcadf129b8c951c9a96..7fad2c191f3af5e38904151e0f327ab4206042e4 100644
--- a/src/common/slurmdbd_defs.c
+++ b/src/common/slurmdbd_defs.c
@@ -38,26 +38,18 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
 #include <arpa/inet.h>
 #include <fcntl.h>
+#include <inttypes.h>
+#include <poll.h>
 #include <pthread.h>
 #include <stdio.h>
-#include <syslog.h>
-#include <poll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <syslog.h>
 #include <time.h>
 #include <unistd.h>
 
diff --git a/src/common/slurmdbd_defs.h b/src/common/slurmdbd_defs.h
index a177d60d849161ba6d44cd0543a1ae56b47efe1c..78f1be43f64823a2fdacb850ea13deecae95f302 100644
--- a/src/common/slurmdbd_defs.h
+++ b/src/common/slurmdbd_defs.h
@@ -41,16 +41,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "slurm/slurm.h"
 
diff --git a/src/common/xcgroup_read_config.h b/src/common/xcgroup_read_config.h
index dffa8c5ac127268b99d988b48a03c7387b4563a1..53cb3af9a8cb4b6e2383b8e3c610d444bb016227 100644
--- a/src/common/xcgroup_read_config.h
+++ b/src/common/xcgroup_read_config.h
@@ -39,16 +39,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#include <stdint.h>
-#endif  /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 /*  Default lower bound on memory limit in MB. This is required so we
  *   don't immediately kill slurmstepd on mem cgroup creation if
diff --git a/src/database/mysql_common.h b/src/database/mysql_common.h
index e3adb3ccffe439736eb5bdb8de137c2d3b59a7fe..468e02f735af477fb1b03ab764273bf1a7608d6e 100644
--- a/src/database/mysql_common.h
+++ b/src/database/mysql_common.h
@@ -45,21 +45,14 @@
 #  include "config.h"
 #endif
 
-#ifdef WITH_PTHREADS
-#  include <pthread.h>
-#endif				/* WITH_PTHREADS */
-
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
+#include <inttypes.h>
+#include <pthread.h>
 #include <stdio.h>
+
 #include "slurm/slurm_errno.h"
 #include "src/common/list.h"
 #include "src/common/xstring.h"
+
 #include <mysql.h>
 #include <mysqld_error.h>
 
diff --git a/src/plugins/accounting_storage/common/common_as.c b/src/plugins/accounting_storage/common/common_as.c
index 3872617d538bacaca40d5bd59e216cccfc4b3d7a..b0db9e19af56d00b661e4cc0ac802b7c44ca6a09 100644
--- a/src/plugins/accounting_storage/common/common_as.c
+++ b/src/plugins/accounting_storage/common/common_as.c
@@ -36,11 +36,12 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#include <strings.h>
+#include <fcntl.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <fcntl.h>
+
 #include "src/common/env.h"
 #include "src/common/slurmdbd_defs.h"
 #include "src/common/slurm_auth.h"
diff --git a/src/plugins/accounting_storage/filetxt/accounting_storage_filetxt.c b/src/plugins/accounting_storage/filetxt/accounting_storage_filetxt.c
index 49c9478fabe80a0cb1bdb4e1d5c311554dea0a35..5aa5e4789c10ecbaed5a5838f1e2e905816b82ea 100644
--- a/src/plugins/accounting_storage/filetxt/accounting_storage_filetxt.c
+++ b/src/plugins/accounting_storage/filetxt/accounting_storage_filetxt.c
@@ -36,7 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#include <strings.h>
+#include <string.h>
 #include "src/common/slurm_xlator.h"
 #include "src/common/slurm_accounting_storage.h"
 #include "filetxt_jobacct_process.h"
diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h
index 16ade4c1a958d34e15dbb4eb051a4124db51207d..f17908b749ee51a184512bd3ca49bad4e7c85909 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h
@@ -39,7 +39,7 @@
 #ifndef _HAVE_ACCOUNTING_STORAGE_MYSQL_H
 #define _HAVE_ACCOUNTING_STORAGE_MYSQL_H
 
-#include <strings.h>
+#include <string.h>
 #include <stdlib.h>
 
 /* we can't include common/slurm_xlator.h here since it contains
diff --git a/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c b/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c
index fdad804484f50656b62c8ea168cd02fca521bb31..0176a09fb2680faf4d871c2561ac903240f0c820 100644
--- a/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c
+++ b/src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c
@@ -40,20 +40,14 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #if HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
 
+#include <inttypes.h>
+#include <pwd.h>
 #include <stdio.h>
 #include <sys/types.h>
-#include <pwd.h>
 
 #include "slurm/slurm_errno.h"
 
diff --git a/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c b/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c
index 02caf555ca7245f8d2556f10853fc2588a50d327..be7803e1136d50d5d2a07c07e15abd904f3d6d51 100644
--- a/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c
+++ b/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c
@@ -37,17 +37,14 @@
  *  Copyright (C) 2002 The Regents of the University of California.
 \*****************************************************************************/
 
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#include <unistd.h>
 #include <getopt.h>
 #include <netinet/in.h>
-
+#include <signal.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "src/common/slurm_xlator.h"
 #include "src/common/slurm_acct_gather_infiniband.h"
diff --git a/src/plugins/acct_gather_profile/hdf5/hdf5_api.h b/src/plugins/acct_gather_profile/hdf5/hdf5_api.h
index 9f59cfd8e54ea317e92d0b4556bef4d52e142596..60a6fa0e3dfaaf5bf468c124a7658e02407230f2 100644
--- a/src/plugins/acct_gather_profile/hdf5/hdf5_api.h
+++ b/src/plugins/acct_gather_profile/hdf5/hdf5_api.h
@@ -45,17 +45,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdlib.h>
 
 #include <hdf5.h>
diff --git a/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/hdf5_api.h b/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/hdf5_api.h
index 001fc1ae6105a863ef13ee47b9f9892eb9f6b885..c7dec5f5d2e4bd8238f4e2ebe7091c15d290c1f6 100644
--- a/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/hdf5_api.h
+++ b/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/hdf5_api.h
@@ -45,17 +45,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdlib.h>
 
 #include <hdf5.h>
diff --git a/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/sh5util.c b/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/sh5util.c
index 259cc8434f848fecfa22e6fefd02c5bd2fd99aa1..7266ed6253b212454fa0b8da5358f38f6fceb0c8 100644
--- a/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/sh5util.c
+++ b/src/plugins/acct_gather_profile/hdf5/sh5util/libsh5util_old/sh5util.c
@@ -51,19 +51,14 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <dirent.h>
-#include <sys/stat.h>
 #include <fcntl.h>
+#include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
+#include <sys/stat.h>
 
 #include "src/common/uid.h"
 #include "src/common/read_config.h"
diff --git a/src/plugins/acct_gather_profile/hdf5/sh5util/sh5util.c b/src/plugins/acct_gather_profile/hdf5/sh5util/sh5util.c
index 51c263083f462b3f6b3bb21e172d0b61d17b3310..2a115aecc36f64c03639538eda50e46e069f6d34 100644
--- a/src/plugins/acct_gather_profile/hdf5/sh5util/sh5util.c
+++ b/src/plugins/acct_gather_profile/hdf5/sh5util/sh5util.c
@@ -51,18 +51,13 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <dirent.h>
-#include <sys/stat.h>
 #include <fcntl.h>
+#include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <sys/time.h>
 
 #include "src/common/uid.h"
diff --git a/src/plugins/auth/munge/auth_munge.c b/src/plugins/auth/munge/auth_munge.c
index 7f27de5e8f71b3f72319020103553848a870bcc8..c98305361f89033a3ff38d2a5fceafce8372a9e9 100644
--- a/src/plugins/auth/munge/auth_munge.c
+++ b/src/plugins/auth/munge/auth_munge.c
@@ -39,32 +39,15 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <time.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
 
 #include <munge.h>
 
diff --git a/src/plugins/auth/none/auth_none.c b/src/plugins/auth/none/auth_none.c
index 4f6cb9a216f79afd8ed30c06950af90c37cc2b0c..8a55c2dace4ede61bd0dfc8ea7fae234cfde4435 100644
--- a/src/plugins/auth/none/auth_none.c
+++ b/src/plugins/auth/none/auth_none.c
@@ -39,30 +39,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 #include "src/common/slurm_xlator.h"
diff --git a/src/plugins/checkpoint/aix/checkpoint_aix.c b/src/plugins/checkpoint/aix/checkpoint_aix.c
index 307e8d7257e98a609685f081bc5cd126a6122bc7..d591edeefe5ef9a9b12f09a3a73e364d050ebc9b 100644
--- a/src/plugins/checkpoint/aix/checkpoint_aix.c
+++ b/src/plugins/checkpoint/aix/checkpoint_aix.c
@@ -41,16 +41,8 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-#ifdef WITH_PTHREADS
-#  include <pthread.h>
-#endif
-
+#include <inttypes.h>
+#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <time.h>
diff --git a/src/plugins/checkpoint/blcr/checkpoint_blcr.c b/src/plugins/checkpoint/blcr/checkpoint_blcr.c
index ed70858ed0387cdd1ebe8ed96d5366ccce12c0ea..039e73d7f9d9a2930f254cece70725e006ac8fc9 100644
--- a/src/plugins/checkpoint/blcr/checkpoint_blcr.c
+++ b/src/plugins/checkpoint/blcr/checkpoint_blcr.c
@@ -39,22 +39,14 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-#ifdef WITH_PTHREADS
-#  include <pthread.h>
-#endif
-
+#include <inttypes.h>
+#include <libgen.h>
+#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
-#include <libgen.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
diff --git a/src/plugins/checkpoint/none/checkpoint_none.c b/src/plugins/checkpoint/none/checkpoint_none.c
index 469d668b27b9fda5fec441db4fe7df78fd403be2..9f78cc8097911e560c5ac8701a3f4dee8a2df49c 100644
--- a/src/plugins/checkpoint/none/checkpoint_none.c
+++ b/src/plugins/checkpoint/none/checkpoint_none.c
@@ -41,13 +41,7 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
+#include <inttypes.h>
 #include <stdio.h>
 
 #include "slurm/slurm.h"
diff --git a/src/plugins/checkpoint/ompi/checkpoint_ompi.c b/src/plugins/checkpoint/ompi/checkpoint_ompi.c
index 6def4764db98cab4cb5de062326d728927c81500..04561809f4358adc65ad465c5da4a54c0d1f894a 100644
--- a/src/plugins/checkpoint/ompi/checkpoint_ompi.c
+++ b/src/plugins/checkpoint/ompi/checkpoint_ompi.c
@@ -41,13 +41,7 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
+#include <inttypes.h>
 #include <stdio.h>
 
 #include "slurm/slurm.h"
diff --git a/src/plugins/checkpoint/poe/checkpoint_poe.c b/src/plugins/checkpoint/poe/checkpoint_poe.c
index 1926569025b4ebba6946fb7c20c95de9baa6f156..2bda9df6d933739fad1a19b47e2179983c67ed93 100644
--- a/src/plugins/checkpoint/poe/checkpoint_poe.c
+++ b/src/plugins/checkpoint/poe/checkpoint_poe.c
@@ -47,16 +47,8 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-#ifdef WITH_PTHREADS
-#  include <pthread.h>
-#endif
-
+#include <inttypes.h>
+#include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <time.h>
diff --git a/src/plugins/core_spec/cray/core_spec_cray.c b/src/plugins/core_spec/cray/core_spec_cray.c
index 2713f94e86ab4095cd6cf88681d8a4115bb64725..f35401860e70803a84cc8f6f3718f8b1d8930bf0 100644
--- a/src/plugins/core_spec/cray/core_spec_cray.c
+++ b/src/plugins/core_spec/cray/core_spec_cray.c
@@ -36,30 +36,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/core_spec/none/core_spec_none.c b/src/plugins/core_spec/none/core_spec_none.c
index 2d4749d159fc9623d02443f7fd94273719cc73d7..2a322cfc48411a77a34d1a3d06111f8b4ee67467 100644
--- a/src/plugins/core_spec/none/core_spec_none.c
+++ b/src/plugins/core_spec/none/core_spec_none.c
@@ -36,30 +36,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/crypto/munge/crypto_munge.c b/src/plugins/crypto/munge/crypto_munge.c
index 14947c82ef5eab7bfdf9ef8ecc4929cd81784d93..5db95b605e0b78c51c9827baf26f422e76661fb5 100644
--- a/src/plugins/crypto/munge/crypto_munge.c
+++ b/src/plugins/crypto/munge/crypto_munge.c
@@ -39,23 +39,14 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <stdint.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#define GPL_LICENSED 1
 #include <munge.h>
 
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/crypto/openssl/crypto_openssl.c b/src/plugins/crypto/openssl/crypto_openssl.c
index 2fa9767aaeed11b14aa5378b9f3b5dd70061f856..914f6212ed97760b51b7788cd73276afa0c2e181 100644
--- a/src/plugins/crypto/openssl/crypto_openssl.c
+++ b/src/plugins/crypto/openssl/crypto_openssl.c
@@ -39,17 +39,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <stdint.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
 
 /*
diff --git a/src/plugins/gres/gpu/gres_gpu.c b/src/plugins/gres/gpu/gres_gpu.c
index d5a1bd66eb6e8aad5fbf37517321af82582d7d07..effa14dc0417199e8de198a352d97d01f408d02d 100644
--- a/src/plugins/gres/gpu/gres_gpu.c
+++ b/src/plugins/gres/gpu/gres_gpu.c
@@ -39,33 +39,16 @@
 #define _GNU_SOURCE
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <sched.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/gres/mic/gres_mic.c b/src/plugins/gres/mic/gres_mic.c
index f91d75d17afbbe694bb53350bbeffad7ccf102b8..8d92b1fe444b92e51c4ed6ace251b35810ebc7a8 100644
--- a/src/plugins/gres/mic/gres_mic.c
+++ b/src/plugins/gres/mic/gres_mic.c
@@ -40,32 +40,15 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <ctype.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/gres/nic/gres_nic.c b/src/plugins/gres/nic/gres_nic.c
index f53d45c23e79b542e08e9a20b48e9a6dcce08fad..31977e8f8bd41cce46ead40c120d6a6cbccd04c9 100644
--- a/src/plugins/gres/nic/gres_nic.c
+++ b/src/plugins/gres/nic/gres_nic.c
@@ -38,32 +38,15 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/job_submit/all_partitions/job_submit_all_partitions.c b/src/plugins/job_submit/all_partitions/job_submit_all_partitions.c
index 2d00244771d502b58a6185196a0b864540945aa2..d5bc0123d6329bdbe0dede2efd3c49f3ae81da75 100644
--- a/src/plugins/job_submit/all_partitions/job_submit_all_partitions.c
+++ b/src/plugins/job_submit/all_partitions/job_submit_all_partitions.c
@@ -39,30 +39,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 #include "src/common/slurm_xlator.h"
diff --git a/src/plugins/job_submit/cray/job_submit_cray.c b/src/plugins/job_submit/cray/job_submit_cray.c
index f8b12393af98ce1fbc85f12bd3bd1f4e29b5baac..5aeea221f47006134f17de831165e0f94dcfc244 100644
--- a/src/plugins/job_submit/cray/job_submit_cray.c
+++ b/src/plugins/job_submit/cray/job_submit_cray.c
@@ -38,30 +38,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 #include "src/common/slurm_xlator.h"
diff --git a/src/plugins/job_submit/defaults/job_submit_defaults.c b/src/plugins/job_submit/defaults/job_submit_defaults.c
index 3c9402be6260877083d8b264f545acbc1d0d2d2c..ca8f6eae9ab81c08a21b77452ea8e24a380ff86c 100644
--- a/src/plugins/job_submit/defaults/job_submit_defaults.c
+++ b/src/plugins/job_submit/defaults/job_submit_defaults.c
@@ -38,30 +38,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 #include "src/common/slurm_xlator.h"
diff --git a/src/plugins/job_submit/logging/job_submit_logging.c b/src/plugins/job_submit/logging/job_submit_logging.c
index a6ec3a0f6663edbbe1e8b96c630c4e51717aea52..5894ce99f508b7c24bea610174a47985b27e64f9 100644
--- a/src/plugins/job_submit/logging/job_submit_logging.c
+++ b/src/plugins/job_submit/logging/job_submit_logging.c
@@ -38,30 +38,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/job_submit/lua/job_submit_lua.c b/src/plugins/job_submit/lua/job_submit_lua.c
index 7728675fb2b1ac403e469f4cb394c75405ea1259..e81876d8d091aa34f73cd0eb7ea202e54483ab6e 100644
--- a/src/plugins/job_submit/lua/job_submit_lua.c
+++ b/src/plugins/job_submit/lua/job_submit_lua.c
@@ -41,17 +41,11 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #include <dlfcn.h>
+#include <inttypes.h>
 #include <pthread.h>
-#include <stdio.h>
 #include <signal.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
diff --git a/src/plugins/job_submit/partition/job_submit_partition.c b/src/plugins/job_submit/partition/job_submit_partition.c
index b373b77dcc31a7d67dc0820918e0d63e8013e3b1..ba275e52ae8b894d299c6aba9e2ada0d96e181e5 100644
--- a/src/plugins/job_submit/partition/job_submit_partition.c
+++ b/src/plugins/job_submit/partition/job_submit_partition.c
@@ -39,30 +39,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 #include "src/common/slurm_xlator.h"
diff --git a/src/plugins/job_submit/pbs/job_submit_pbs.c b/src/plugins/job_submit/pbs/job_submit_pbs.c
index 7b3264c7a82787db8c9c9081f914d25e42f6a94e..fc61319b32b25b710b149e1f5c684857e9d7b985 100644
--- a/src/plugins/job_submit/pbs/job_submit_pbs.c
+++ b/src/plugins/job_submit/pbs/job_submit_pbs.c
@@ -39,22 +39,14 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <stdio.h>
-
-#include <sys/types.h>
+#include <dlfcn.h>
+#include <inttypes.h>
+#include <pthread.h>
 #include <signal.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <unistd.h>
-#include <dlfcn.h>
-#include <pthread.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/job_submit/throttle/job_submit_throttle.c b/src/plugins/job_submit/throttle/job_submit_throttle.c
index 896067df5a071b5fc79e02a56e2c4bd3913bf9e5..4a84e758f843cec128d1e1aa37bdac8363bbdda1 100644
--- a/src/plugins/job_submit/throttle/job_submit_throttle.c
+++ b/src/plugins/job_submit/throttle/job_submit_throttle.c
@@ -40,30 +40,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 #include "src/common/slurm_xlator.h"
diff --git a/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c b/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
index d185acded4cea49719c090452101459548929db2..1d6728e2b9eb97655929604b3499e335abdea564 100644
--- a/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
+++ b/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
@@ -40,15 +40,9 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #include <curl/curl.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <grp.h>
 #include <pwd.h>
 #include <stdlib.h>
@@ -56,6 +50,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+
 #include "src/common/assoc_mgr.h"
 #include "src/common/fd.h"
 #include "src/common/list.h"
diff --git a/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c b/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c
index 633478dce0d5e4db351ff2685799e6d8e8377df3..a706b72b7154980a217ad97ccf7f4713eaa8c274 100644
--- a/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c
+++ b/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c
@@ -40,17 +40,12 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #include <fcntl.h>
-#include <pwd.h>
 #include <grp.h>
+#include <inttypes.h>
+#include <pwd.h>
 #include <unistd.h>
+
 #include "src/common/slurm_protocol_defs.h"
 #include "src/common/slurm_jobcomp.h"
 #include "src/common/parse_time.h"
diff --git a/src/plugins/jobcomp/none/jobcomp_none.c b/src/plugins/jobcomp/none/jobcomp_none.c
index 0f8c978027f0362bdd13e03d7a41b79dc8e529eb..c993abd9fcf0b924f07e08cf7183905e6529aa2f 100644
--- a/src/plugins/jobcomp/none/jobcomp_none.c
+++ b/src/plugins/jobcomp/none/jobcomp_none.c
@@ -40,13 +40,7 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
+#include <inttypes.h>
 #include <stdio.h>
 
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/jobcomp/script/jobcomp_script.c b/src/plugins/jobcomp/script/jobcomp_script.c
index 7af271623312231ce8dd4a82b93f23d070cae1a8..35f201f892255ee9f16cfbcf5571f5da11340ab6 100644
--- a/src/plugins/jobcomp/script/jobcomp_script.c
+++ b/src/plugins/jobcomp/script/jobcomp_script.c
@@ -67,27 +67,21 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #if HAVE_PATHS_H
 #  include <paths.h>
 #endif
 
+#include <fcntl.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
+#include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <pthread.h>
-#include <signal.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/mpi/mpichgm/mpichgm.c b/src/plugins/mpi/mpichgm/mpichgm.c
index 2365b33021868d71bbd6c20b220697ca82991024..62186d144979eb69acffd2a56d674d030114067a 100644
--- a/src/plugins/mpi/mpichgm/mpichgm.c
+++ b/src/plugins/mpi/mpichgm/mpichgm.c
@@ -49,7 +49,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <strings.h>
+#include <string.h>
 
 #include "src/common/slurm_xlator.h"
 #include "src/common/net.h"
diff --git a/src/plugins/mpi/mpichmx/mpichmx.c b/src/plugins/mpi/mpichmx/mpichmx.c
index adf0a32529e146e4c2180a5ec085bd4c8f0aefa8..18a0f394c5e88500ccd154c1100fd47d266f1db0 100644
--- a/src/plugins/mpi/mpichmx/mpichmx.c
+++ b/src/plugins/mpi/mpichmx/mpichmx.c
@@ -49,7 +49,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <strings.h>
+#include <string.h>
 
 #include "src/common/slurm_xlator.h"
 #include "src/common/net.h"
diff --git a/src/plugins/mpi/mvapich/mvapich.c b/src/plugins/mpi/mvapich/mvapich.c
index 02f416fa8e07afa73773555bfb0fb5cd44681377..e41522d5df3c0fbf557e2cc8b805f13d3b5aeed7 100644
--- a/src/plugins/mpi/mvapich/mvapich.c
+++ b/src/plugins/mpi/mvapich/mvapich.c
@@ -49,7 +49,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <strings.h>
+#include <string.h>
 #include <poll.h>
 #include <sys/time.h>
 
diff --git a/src/plugins/mpi/pmi2/client.h b/src/plugins/mpi/pmi2/client.h
index 85bbe77bcb9d732dc518256bdce4d32effb22ff4..ce6461c807063e9c4cde04ab9463e58e3d35d6e9 100644
--- a/src/plugins/mpi/pmi2/client.h
+++ b/src/plugins/mpi/pmi2/client.h
@@ -40,16 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "spawn.h"
 
diff --git a/src/plugins/mpi/pmi2/info.h b/src/plugins/mpi/pmi2/info.h
index 095f955f0571ff82a3358e19a263d0c265e2f9ee..97a2bd42107e24a6bcfbff12d434e9deee001724 100644
--- a/src/plugins/mpi/pmi2/info.h
+++ b/src/plugins/mpi/pmi2/info.h
@@ -40,16 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 extern char *job_attr_get(char *key);
 extern char *node_attr_get(char *key);
diff --git a/src/plugins/mpi/pmi2/setup.h b/src/plugins/mpi/pmi2/setup.h
index 0e0a91cedde2231429d3dafc5bd1e0f522dfdfff..fed054e1151cac09ddd357c6a92871d82551b700 100644
--- a/src/plugins/mpi/pmi2/setup.h
+++ b/src/plugins/mpi/pmi2/setup.h
@@ -43,25 +43,17 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
+
+#include "slurm/slurm_errno.h"
 
-#include <slurm/slurm_errno.h>
 #include "src/common/slurm_xlator.h"
 #include "src/common/pack.h"
 #include "src/common/slurm_mpi.h"
 #include "src/common/xstring.h"
-
 #include "src/slurmd/slurmstepd/slurmstepd_job.h"
-
 #include "src/srun/libsrun/debugger.h"
 #include "src/srun/libsrun/opt.h"
 
diff --git a/src/plugins/mpi/pmi2/spawn.h b/src/plugins/mpi/pmi2/spawn.h
index 4e534666bce4dbf8358b7cbfd5c11facb568ed16..6c15e57f8771de60617171815ba8522cd1095d4e 100644
--- a/src/plugins/mpi/pmi2/spawn.h
+++ b/src/plugins/mpi/pmi2/spawn.h
@@ -40,16 +40,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "src/common/pack.h"
 
diff --git a/src/plugins/priority/basic/priority_basic.c b/src/plugins/priority/basic/priority_basic.c
index 16dce1fd51864a2bf3c43bcf48b7b6ae401f3d52..ec6e1d923bd06cacedaa51ffa871ad8b62cd1d45 100644
--- a/src/plugins/priority/basic/priority_basic.c
+++ b/src/plugins/priority/basic/priority_basic.c
@@ -40,15 +40,9 @@
 #  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <stdio.h>
+#include <inttypes.h>
 #include <math.h>
+#include <stdio.h>
 
 #include "slurm/slurm_errno.h"
 
diff --git a/src/plugins/priority/multifactor/priority_multifactor.c b/src/plugins/priority/multifactor/priority_multifactor.c
index 617303a158e1c621f30c7dd510c1f2fef0315648..78dd979c90f99943e71f326ae142ab4f3f0a33da 100644
--- a/src/plugins/priority/multifactor/priority_multifactor.c
+++ b/src/plugins/priority/multifactor/priority_multifactor.c
@@ -47,30 +47,17 @@
 #  include "config.h"
 #endif
 
-#if HAVE_FLOAT_H
-#  include <float.h>
-#endif
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-#ifdef WITH_PTHREADS
-#  include <pthread.h>
-#endif				/* WITH_PTHREADS */
-#if HAVE_VALUES_H
-#  include <values.h>
-#endif
 #if HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
 
-#include <sys/stat.h>
-#include <stdio.h>
 #include <fcntl.h>
-
+#include <limits.h>
 #include <math.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
 #include "slurm/slurm_errno.h"
 
 #include "src/common/parse_time.h"
diff --git a/src/plugins/proctrack/aix/proctrack_aix.c b/src/plugins/proctrack/aix/proctrack_aix.c
index 434e533cfcf9e72e6a8761efea3332e4b9e4100b..299124d40d20d3ed4c59f330d826d397d56cf01a 100644
--- a/src/plugins/proctrack/aix/proctrack_aix.c
+++ b/src/plugins/proctrack/aix/proctrack_aix.c
@@ -40,18 +40,12 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <sys/types.h>
+#include <inttypes.h>
+#include <proctrack.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <unistd.h>
-#include <proctrack.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/proctrack/cgroup/proctrack_cgroup.c b/src/plugins/proctrack/cgroup/proctrack_cgroup.c
index 4a1690ff5ec24c4ef87fba5d4244ca6d4c0aeadd..9659d779205fe338db24b9b83674d1dec0bba377 100644
--- a/src/plugins/proctrack/cgroup/proctrack_cgroup.c
+++ b/src/plugins/proctrack/cgroup/proctrack_cgroup.c
@@ -38,18 +38,12 @@
 #include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
 #include <fcntl.h>
+#include <inttypes.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/proctrack/cray/proctrack_cray.c b/src/plugins/proctrack/cray/proctrack_cray.c
index 838029f9034a96483a3c3ab7dd57134283dacb4c..8c0533f6d63ef729a32d8195230af6e45505bf9d 100644
--- a/src/plugins/proctrack/cray/proctrack_cray.c
+++ b/src/plugins/proctrack/cray/proctrack_cray.c
@@ -42,20 +42,14 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
+#include <dlfcn.h>
 #include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <inttypes.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
-#include <dlfcn.h>
 
 #include <job.h>	/* Cray's job module component */
 
diff --git a/src/plugins/proctrack/linuxproc/kill_tree.c b/src/plugins/proctrack/linuxproc/kill_tree.c
index 83d792afef096f0e1679329277ac8d7f01c9f1db..ec161c822c5bc3875cba7a20e63007215299bda3 100644
--- a/src/plugins/proctrack/linuxproc/kill_tree.c
+++ b/src/plugins/proctrack/linuxproc/kill_tree.c
@@ -41,17 +41,16 @@
 #  include "config.h"
 #endif
 
-#include <sys/types.h>
 #include <dirent.h>
-#include <sys/stat.h>
 #include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include <limits.h>
 #include <signal.h>
-#include <strings.h>
-#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/proctrack/linuxproc/proctrack_linuxproc.c b/src/plugins/proctrack/linuxproc/proctrack_linuxproc.c
index 5e97f32c852a927d5c223d6f4ca6fa7a0b9f0d3f..17256268243a14df80c9aa845d8f153eecd3ee0b 100644
--- a/src/plugins/proctrack/linuxproc/proctrack_linuxproc.c
+++ b/src/plugins/proctrack/linuxproc/proctrack_linuxproc.c
@@ -37,18 +37,12 @@
 \*****************************************************************************/
 
 #if HAVE_CONFIG_H
-#   include "config.h"
+#  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <sys/types.h>
+#include <inttypes.h>
 #include <signal.h>	/* SIGKILL */
+#include <sys/types.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/proctrack/lua/proctrack_lua.c b/src/plugins/proctrack/lua/proctrack_lua.c
index 280c9f7b9624cde5e28e90e5726263c4084507ca..8712ddf4e72251375ca0c81763c04de8db495daf 100644
--- a/src/plugins/proctrack/lua/proctrack_lua.c
+++ b/src/plugins/proctrack/lua/proctrack_lua.c
@@ -37,22 +37,16 @@
 \*****************************************************************************/
 
 #if HAVE_CONFIG_H
-#   include "config.h"
+#  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <sys/types.h>
+#include <dlfcn.h>
+#include <inttypes.h>
+#include <pthread.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <unistd.h>
-#include <dlfcn.h>
-#include <pthread.h>
 
 #include <lua.h>
 #include <lauxlib.h>
@@ -66,7 +60,6 @@
 #include "src/common/xlua.h"
 #include "src/slurmd/slurmstepd/slurmstepd_job.h"
 
-
 const char plugin_name[]            = "LUA proctrack module";
 const char plugin_type[]            = "proctrack/lua";
 const uint32_t plugin_version       = SLURM_VERSION_NUMBER;
diff --git a/src/plugins/proctrack/pgid/proctrack_pgid.c b/src/plugins/proctrack/pgid/proctrack_pgid.c
index 869136b165523aa7b39a5dc1cf853a2487170b02..8c2eeb57263c3e1fdb181054eaffd1a7694f5148 100644
--- a/src/plugins/proctrack/pgid/proctrack_pgid.c
+++ b/src/plugins/proctrack/pgid/proctrack_pgid.c
@@ -40,26 +40,20 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #ifndef   __USE_XOPEN_EXTENDED
 #  define __USE_XOPEN_EXTENDED /* getpgid */
 #endif
-#include <unistd.h>
 
 #include <dirent.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <limits.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/plugins/proctrack/sgi_job/proctrack_sgi_job.c b/src/plugins/proctrack/sgi_job/proctrack_sgi_job.c
index fcc5569df8aa43ed56a31b941b9904be0830dcad..35ed470aa7dd47c5458aaeb1cd89bce93659ae4d 100644
--- a/src/plugins/proctrack/sgi_job/proctrack_sgi_job.c
+++ b/src/plugins/proctrack/sgi_job/proctrack_sgi_job.c
@@ -37,21 +37,15 @@
 \*****************************************************************************/
 
 #if HAVE_CONFIG_H
-#   include "config.h"
+#  include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <sys/types.h>
+#include <dlfcn.h>
+#include <inttypes.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <unistd.h>
-#include <dlfcn.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
@@ -59,7 +53,6 @@
 
 #include "src/slurmd/slurmstepd/slurmstepd_job.h"
 
-
 const char plugin_name[]      = "Process tracking via SGI job module";
 const char plugin_type[]      = "proctrack/sgi_job";
 const uint32_t plugin_version = SLURM_VERSION_NUMBER;
diff --git a/src/plugins/sched/wiki/hostlist.c b/src/plugins/sched/wiki/hostlist.c
index 96d99899f79631dd1f33ecec97277175ea0ba1b3..58d5ab9c787dec5ac1112c2c13a030c17ef3b5ad 100644
--- a/src/plugins/sched/wiki/hostlist.c
+++ b/src/plugins/sched/wiki/hostlist.c
@@ -39,21 +39,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "./msg.h"
+#include "msg.h"
 #include "src/common/hostlist.h"
 #include "src/common/node_select.h"
 #include "src/common/xmalloc.h"
diff --git a/src/plugins/sched/wiki/job_modify.c b/src/plugins/sched/wiki/job_modify.c
index 762cc20520b34dc776589cea83372d8c27627f8d..56232a3fcedb2d59110f4d3840497b854e6c552a 100644
--- a/src/plugins/sched/wiki/job_modify.c
+++ b/src/plugins/sched/wiki/job_modify.c
@@ -37,7 +37,7 @@
 \*****************************************************************************/
 
 #include "./msg.h"
-#include <strings.h>
+#include <string.h>
 #include "src/slurmctld/job_scheduler.h"
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
diff --git a/src/plugins/sched/wiki/msg.h b/src/plugins/sched/wiki/msg.h
index 9d81afbfdc710de8fa53622d4f6b23973b7c2295..d15e636f80f3adf6079ccde425b2d402d14c77fe 100644
--- a/src/plugins/sched/wiki/msg.h
+++ b/src/plugins/sched/wiki/msg.h
@@ -50,24 +50,16 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 
diff --git a/src/plugins/sched/wiki2/hostlist.c b/src/plugins/sched/wiki2/hostlist.c
index 435e1fbd4d5c5d89eba378d134da2626907b0888..819597fa21667affeb2c29e4f190d1e66fc670c7 100644
--- a/src/plugins/sched/wiki2/hostlist.c
+++ b/src/plugins/sched/wiki2/hostlist.c
@@ -39,17 +39,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/src/plugins/sched/wiki2/initialize.c b/src/plugins/sched/wiki2/initialize.c
index af0f3b6d1ad3fa6c6402f440f1a4735cfb7f8ce5..218f4fcc44964d1c0559eeb2e2cff3ec3cd99021 100644
--- a/src/plugins/sched/wiki2/initialize.c
+++ b/src/plugins/sched/wiki2/initialize.c
@@ -37,7 +37,7 @@
 \*****************************************************************************/
 
 #include "./msg.h"
-#include <strings.h>
+#include <string.h>
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
 
diff --git a/src/plugins/sched/wiki2/job_modify.c b/src/plugins/sched/wiki2/job_modify.c
index 6cbb2d3aaa9a2bdc820161aeda7eec1bba6f3d71..2bfe35cd6f15f3b1c708bd99f7a1d9d1ef66a29c 100644
--- a/src/plugins/sched/wiki2/job_modify.c
+++ b/src/plugins/sched/wiki2/job_modify.c
@@ -38,7 +38,7 @@
 \*****************************************************************************/
 
 #include "./msg.h"
-#include <strings.h>
+#include <string.h>
 #include "src/common/gres.h"
 #include "src/common/node_select.h"
 #include "src/common/assoc_mgr.h"
diff --git a/src/plugins/sched/wiki2/job_notify.c b/src/plugins/sched/wiki2/job_notify.c
index 5cab0db1a6e6373eca6530e1c26408e37e41d28c..9487c8323260066c14316e6422b195dacfdb2eef 100644
--- a/src/plugins/sched/wiki2/job_notify.c
+++ b/src/plugins/sched/wiki2/job_notify.c
@@ -37,7 +37,7 @@
 \*****************************************************************************/
 
 #include "./msg.h"
-#include <strings.h>
+#include <string.h>
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
 #include "src/slurmctld/srun_comm.h"
diff --git a/src/plugins/sched/wiki2/job_signal.c b/src/plugins/sched/wiki2/job_signal.c
index befc22d4ee7a4fb1b0ad5f85aafe5eb0c96213a2..2d725235072a76f77f928eaa79b81d76b77c25a6 100644
--- a/src/plugins/sched/wiki2/job_signal.c
+++ b/src/plugins/sched/wiki2/job_signal.c
@@ -37,7 +37,7 @@
 \*****************************************************************************/
 
 #include "./msg.h"
-#include <strings.h>
+#include <string.h>
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
 
diff --git a/src/plugins/sched/wiki2/msg.h b/src/plugins/sched/wiki2/msg.h
index 0d77179d2f2b8de57daf48efbb6d2c076ef2a32a..8cefdb0b9a4a2bfa4e937678b68b3cdec8819277 100644
--- a/src/plugins/sched/wiki2/msg.h
+++ b/src/plugins/sched/wiki2/msg.h
@@ -50,24 +50,16 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm_errno.h"
 
diff --git a/src/plugins/select/alps/libemulate/alps_emulate.c b/src/plugins/select/alps/libemulate/alps_emulate.c
index e6bf8c0e414722d6805a2247867522de6bb0d4cb..c55c6e412da9120f41818633b09fac6c8b3d8ae8 100644
--- a/src/plugins/select/alps/libemulate/alps_emulate.c
+++ b/src/plugins/select/alps/libemulate/alps_emulate.c
@@ -37,19 +37,16 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
+
+#include <inttypes.h>
 #include <stdlib.h>
 #include <unistd.h>
 
 #include "src/common/log.h"
 #include "src/common/node_conf.h"
 #include "src/common/xmalloc.h"
+
 #include "../basil_alps.h"
 #include "../parser_common.h"
 #include "hilbert.h"
diff --git a/src/plugins/select/alps/select_alps.c b/src/plugins/select/alps/select_alps.c
index 68c5330164e30d0ee3c72935936386ad1a9f154c..810be202e4851af4773d330b650dad63ca7bb4e9 100644
--- a/src/plugins/select/alps/select_alps.c
+++ b/src/plugins/select/alps/select_alps.c
@@ -40,16 +40,11 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
 
 #include "slurm/slurm.h"
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/plugins/select/bluegene/bg_job_run.c b/src/plugins/select/bluegene/bg_job_run.c
index ad432361271a374af09d6f0101d5e1886e92e602..e60454dac258ff8046c2cb30837ee75df087529a 100644
--- a/src/plugins/select/bluegene/bg_job_run.c
+++ b/src/plugins/select/bluegene/bg_job_run.c
@@ -39,17 +39,10 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
-#  if WITH_PTHREADS
-#    include <pthread.h>
-#  endif
 #endif
 
+#include <inttypes.h>
+#include <pthread.h>
 #include <signal.h>
 #include <unistd.h>
 
diff --git a/src/plugins/select/bluegene/sfree/sfree.h b/src/plugins/select/bluegene/sfree/sfree.h
index 83028ce31da7abc6fcf8f2add79e275e1d5a9877..9ac2180f4b37a05fb7f877fc33a77869f385609b 100644
--- a/src/plugins/select/bluegene/sfree/sfree.h
+++ b/src/plugins/select/bluegene/sfree/sfree.h
@@ -43,15 +43,11 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>		/* getenv     */
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "../bg_enums.h"
diff --git a/src/plugins/select/bluegene/slurm_epilog.c b/src/plugins/select/bluegene/slurm_epilog.c
index 589cc2e9bd6de838deed428adfb5a129ccaf01e7..3edc22ab297087e7f95958e9dd796b8f5b7fe15e 100644
--- a/src/plugins/select/bluegene/slurm_epilog.c
+++ b/src/plugins/select/bluegene/slurm_epilog.c
@@ -42,13 +42,12 @@
 #  include "config.h"
 #endif
 
-#include <stdlib.h>
 #include <errno.h>
 #include <stdio.h>
-#include <unistd.h>
+#include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 
diff --git a/src/plugins/select/bluegene/slurm_prolog.c b/src/plugins/select/bluegene/slurm_prolog.c
index 597ba3dec9a8b5664414ad0173eba7f6c7a5b284..3ac62220d2776eacc904b32d12c0ee11733e02e8 100644
--- a/src/plugins/select/bluegene/slurm_prolog.c
+++ b/src/plugins/select/bluegene/slurm_prolog.c
@@ -47,7 +47,6 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 
 #include "slurm/slurm.h"
diff --git a/src/plugins/select/cons_res/job_test.c b/src/plugins/select/cons_res/job_test.c
index a53a96047f7b30b41c0185e7f81b210d12ee0376..2994cf05268c0398effdf97da0afdc2480134800 100644
--- a/src/plugins/select/cons_res/job_test.c
+++ b/src/plugins/select/cons_res/job_test.c
@@ -94,13 +94,9 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
+
+#include <inttypes.h>
 #include <time.h>
 
 #include "dist_tasks.h"
diff --git a/src/plugins/select/cons_res/select_cons_res.c b/src/plugins/select/cons_res/select_cons_res.c
index 5eaf6180132e3d50eb0b2c3ffcab356eda2937ab..f5d673ca335ce7ad7b96a7da7b045ead528ef414 100644
--- a/src/plugins/select/cons_res/select_cons_res.c
+++ b/src/plugins/select/cons_res/select_cons_res.c
@@ -97,23 +97,18 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
 
+#include <inttypes.h>
 #include <string.h>
 
 #include "src/common/slurm_xlator.h"
 #include "src/common/slurm_selecttype_info.h"
 #include "select_cons_res.h"
+
 #include "dist_tasks.h"
 #include "job_test.h"
 
-
 #define NODEINFO_MAGIC 0x82aa
 
 /* These are defined here so when we link with something other than
diff --git a/src/plugins/select/cray/ccm.h b/src/plugins/select/cray/ccm.h
index 69f529fa223444bf06dffef40ed44d9079b8f1dc..a04f8121566c31b6072d282ce463b0aa0d72ba2c 100644
--- a/src/plugins/select/cray/ccm.h
+++ b/src/plugins/select/cray/ccm.h
@@ -38,22 +38,15 @@
 #ifndef SELECT_CRAY_CCM_H
 #define SELECT_CRAY_CCM_H
 
-#include "src/common/slurm_xlator.h"
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
-#  if WITH_PTHREADS
-#    include <pthread.h>
-#  endif
 #endif
 
-/* CCM use */
+#include <inttypes.h>
+#include <pthread.h>
 #include <string.h>
+
+#include "src/common/slurm_xlator.h"
 #include "src/slurmctld/job_scheduler.h"
 #include "src/slurmctld/srun_comm.h"
 
diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c
index c02e36fa25b62240497cf7245265ca8788ea4cfd..e73434a3a8908540558f8452a04353f56c6c052f 100644
--- a/src/plugins/select/linear/select_linear.c
+++ b/src/plugins/select/linear/select_linear.c
@@ -47,14 +47,9 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
diff --git a/src/plugins/select/serial/job_test.c b/src/plugins/select/serial/job_test.c
index afe13082efdfd84fd280c6c2e71ec92209dbd2ae..1d4551acae2d4e0d4a1c199f2f9db4f3be239df4 100644
--- a/src/plugins/select/serial/job_test.c
+++ b/src/plugins/select/serial/job_test.c
@@ -37,13 +37,9 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
+
+#include <inttypes.h>
 #include <time.h>
 
 #include "dist_tasks.h"
diff --git a/src/plugins/select/serial/select_serial.c b/src/plugins/select/serial/select_serial.c
index 9e98b28c66f326e4da89bada97dc01b0d042131f..1ebde3d5c15f313e9e9037229b88de83e5cfb61e 100644
--- a/src/plugins/select/serial/select_serial.c
+++ b/src/plugins/select/serial/select_serial.c
@@ -34,14 +34,10 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  endif
 #endif
 
+#include <inttypes.h>
+
 #include "src/common/slurm_xlator.h"
 #include "src/common/slurm_selecttype_info.h"
 #include "select_serial.h"
diff --git a/src/plugins/slurmctld/nonstop/do_work.c b/src/plugins/slurmctld/nonstop/do_work.c
index 48098afb40b4dfbd7c2ee2938f96447684e16847..6de5de17144e92b8e4a7b166df1a49d7220b0808 100644
--- a/src/plugins/slurmctld/nonstop/do_work.c
+++ b/src/plugins/slurmctld/nonstop/do_work.c
@@ -36,16 +36,10 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif
 #endif
 
 #include <fcntl.h>
+#include <inttypes.h>
 #include <poll.h>
 #include <pthread.h>
 #include <stdlib.h>
@@ -55,8 +49,8 @@
 #include <time.h>
 #include <unistd.h>
 
-//#include "slurm/slurmdb.h"
 #include "slurm/smd_ns.h"
+
 #include "src/common/slurm_xlator.h"	/* Must be first */
 #include "src/common/bitstring.h"
 #include "src/common/job_resources.h"
diff --git a/src/plugins/slurmctld/nonstop/read_config.h b/src/plugins/slurmctld/nonstop/read_config.h
index c11795627ec7089dd44dc13f840500bf26a3dc20..5b8236d88e89d26a81b07cbb826968eb0733a198 100644
--- a/src/plugins/slurmctld/nonstop/read_config.h
+++ b/src/plugins/slurmctld/nonstop/read_config.h
@@ -40,24 +40,12 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_STDBOOL_H
-#    include <stdbool.h>
-#  else
-     typedef enum {false, true} bool;
-#  endif			/* !HAVE_STDBOOL_H */
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
-#define GPL_LICENSED 1
+#include <inttypes.h>
 #include <munge.h>
-#include <unistd.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #define DEFAULT_NONSTOP_PORT		6820
 
diff --git a/src/sacct/sacct.h b/src/sacct/sacct.h
index 3380b0a271b9a6484a92323764b2655a2a6ca36d..04915562d951780f7fa5a34883a147b6d88816db 100644
--- a/src/sacct/sacct.h
+++ b/src/sacct/sacct.h
@@ -51,7 +51,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "src/common/getopt.h"
 #include "src/common/xmalloc.h"
 #include "src/common/xstring.h"
 #include "src/common/list.h"
diff --git a/src/sacctmgr/sacctmgr.h b/src/sacctmgr/sacctmgr.h
index c01da83e73392e1a9032ab74142049ddbe634b05..980c57568f38c78745abf794e129f295f29cafd6 100644
--- a/src/sacctmgr/sacctmgr.h
+++ b/src/sacctmgr/sacctmgr.h
@@ -44,22 +44,13 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 
@@ -68,14 +59,6 @@
 #  include <readline/history.h>
 #endif
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include "slurm/slurm.h"
 
 #include "src/common/slurm_jobacct_gather.h"
diff --git a/src/salloc/opt.c b/src/salloc/opt.c
index 4a02d079a27822cab4e748723a40180700b1bc52..3229261d90be30df76ff1cf51dac28e5b0f7829a 100644
--- a/src/salloc/opt.c
+++ b/src/salloc/opt.c
@@ -42,38 +42,27 @@
 #  include "config.h"
 #endif
 
-#include <string.h>		/* strcpy, strncasecmp */
-
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
-
 #ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #ifdef HAVE_LIMITS_H
 #  include <limits.h>
 #endif
 
 #include <fcntl.h>
+#include <getopt.h>
+#include <pwd.h>		/* getpwuid   */
+#include <ctype.h>		/* isdigit    */
 #include <stdarg.h>		/* va_start   */
 #include <stdio.h>
 #include <stdlib.h>		/* getenv, strtol, etc. */
-#include <pwd.h>		/* getpwuid   */
-#include <ctype.h>		/* isdigit    */
+#include <string.h>		/* strcpy, strncasecmp */
 #include <sys/param.h>		/* MAXPATHLEN */
 #include <sys/stat.h>
-#include <unistd.h>
-#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "src/common/cpu_frequency.h"
 #include "src/common/list.h"
diff --git a/src/sattach/opt.c b/src/sattach/opt.c
index 7b247b3ac34772899b78be4f5cef0aaa63790aaf..01b5eca676a3a74f4e915b9e943aabf3a9a1c4d8 100644
--- a/src/sattach/opt.c
+++ b/src/sattach/opt.c
@@ -29,37 +29,27 @@
 #  include "config.h"
 #endif
 
-#include <string.h>		/* strcpy, strncasecmp */
-
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
 
 #ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #ifdef HAVE_LIMITS_H
 #  include <limits.h>
 #endif
 
+#include <ctype.h>		/* isdigit    */
 #include <fcntl.h>
+#include <getopt.h>
 #include <stdarg.h>		/* va_start   */
 #include <stdio.h>
 #include <stdlib.h>		/* getenv     */
-#include <ctype.h>		/* isdigit    */
+#include <string.h>		/* strcpy, strncasecmp */
 #include <sys/param.h>		/* MAXPATHLEN */
 #include <sys/stat.h>
-#include <unistd.h>
-#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "src/common/list.h"
 #include "src/common/log.h"
diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c
index 2ddb96663afdaaf4236be5cf4c45cfa0b698e1a8..9de467f68f1efa2f25d12346565407ccbb9d1f5f 100644
--- a/src/sbatch/opt.c
+++ b/src/sbatch/opt.c
@@ -42,38 +42,26 @@
 #  include "config.h"
 #endif
 
-#include <string.h>		/* strcpy, strncasecmp */
-
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
-
 #ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #ifdef HAVE_LIMITS_H
 #  include <limits.h>
 #endif
 
 #include <ctype.h>
 #include <fcntl.h>
+#include <getopt.h>
 #include <stdarg.h>		/* va_start   */
 #include <stdio.h>
 #include <stdlib.h>		/* getenv     */
-#include <ctype.h>		/* isdigit    */
+#include <string.h>		/* strcpy, strncasecmp */
 #include <sys/param.h>		/* MAXPATHLEN */
 #include <sys/stat.h>
-#include <unistd.h>
-#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "src/common/cpu_frequency.h"
 #include "src/common/list.h"
diff --git a/src/sbcast/opts.c b/src/sbcast/opts.c
index 9c7bcb1015c135f0fae16a9f8ac0190e03134045..66796582cb6279f8ba0695f2a2e903f2d4a9a23a 100644
--- a/src/sbcast/opts.c
+++ b/src/sbcast/opts.c
@@ -45,12 +45,7 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/scancel/opt.c b/src/scancel/opt.c
index 19a459ffd8d79d370c24c7e8bbd109fc672e3ac7..1e9bac1ec7a04d54add2d74394b9b6d85035ceb4 100644
--- a/src/scancel/opt.c
+++ b/src/scancel/opt.c
@@ -46,12 +46,7 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -59,10 +54,6 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
-
 #include "src/common/log.h"
 #include "src/common/macros.h"
 #include "src/common/slurm_protocol_defs.h"
diff --git a/src/scancel/scancel.c b/src/scancel/scancel.c
index 74cf09b37e651418c6919171a3d287d9707c66d7..3f9e2a5c1f169a4a867ca664b5884ec49e726fe6 100644
--- a/src/scancel/scancel.c
+++ b/src/scancel/scancel.c
@@ -42,21 +42,14 @@
 #  include "config.h"
 #endif
 
-#include <unistd.h>
 #include <errno.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <signal.h>
-#include <pthread.h>
-
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 
diff --git a/src/scontrol/scontrol.h b/src/scontrol/scontrol.h
index ea77d3b305336c9c437ff434c0eaa77716c30efa..af95ab458eeb162d61c35d77626826d705c351d4 100644
--- a/src/scontrol/scontrol.h
+++ b/src/scontrol/scontrol.h
@@ -44,22 +44,13 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <time.h>
@@ -70,14 +61,6 @@
 #  include <readline/history.h>
 #endif
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include "slurm/slurm.h"
 
 #include "src/common/hostlist.h"
diff --git a/src/sdiag/opts.c b/src/sdiag/opts.c
index 8160ffbeb131c401b6da5946f643a20daaf6192e..20925a5d873db69689bcb132ff83bfc9ccc20cb0 100644
--- a/src/sdiag/opts.c
+++ b/src/sdiag/opts.c
@@ -42,12 +42,7 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <stdlib.h>
 #include <unistd.h>
 
diff --git a/src/sinfo/opts.c b/src/sinfo/opts.c
index 96b171c6f6fb77df6a0b7e4cca7ca0d6d6f01d52..cc1f6253203550c398e3510af76dd00e1a7adbed 100644
--- a/src/sinfo/opts.c
+++ b/src/sinfo/opts.c
@@ -46,12 +46,7 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <stdlib.h>
 #include <unistd.h>
 
diff --git a/src/sinfo/sinfo.h b/src/sinfo/sinfo.h
index 3c8f685d2fe917859d5b23aac59a19ce36ad9412..cbb8906f7e00582056acd5f751e72a81386d25c3 100644
--- a/src/sinfo/sinfo.h
+++ b/src/sinfo/sinfo.h
@@ -46,20 +46,13 @@
 #endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include "slurm/slurm.h"
 
 #include "src/common/hostlist.h"
diff --git a/src/slurmctld/burst_buffer.c b/src/slurmctld/burst_buffer.c
index 13c0e5ba587d2445d42275a224b468a6c22d9bf1..7b82f351e8ec8f58297143686d29d6aa3a8db4be 100644
--- a/src/slurmctld/burst_buffer.c
+++ b/src/slurmctld/burst_buffer.c
@@ -36,29 +36,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index b357fc6e86783a65641f49a988a90b7aa9600b34..1c7ab9f91fde97ccfa814b99ddc6b808d37c9643 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -53,7 +53,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/param.h>
diff --git a/src/slurmctld/job_submit.c b/src/slurmctld/job_submit.c
index 7216d5535a7c1978825675ea2c1a742a2f406d9c..64b43903f8ff62ffba3ca90126902fe9552a2d08 100644
--- a/src/slurmctld/job_submit.c
+++ b/src/slurmctld/job_submit.c
@@ -38,29 +38,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h
index dba1df43fcb086fee1b35cf1b1cdca520504996f..11d731ffd77e5c9a2a1ee62aefd7022a339f846a 100644
--- a/src/slurmctld/slurmctld.h
+++ b/src/slurmctld/slurmctld.h
@@ -41,29 +41,17 @@
 #ifndef _HAVE_SLURMCTLD_H
 #define _HAVE_SLURMCTLD_H
 
-
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
 #endif
 
+#include <inttypes.h>
 #include <pthread.h>
-/* #include <stdlib.h> */
 #include <time.h>
-#include <strings.h>
+#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#ifdef WITH_PTHREADS
-#  include <pthread.h>
-#endif				/* WITH_PTHREADS */
-
 #include "slurm/slurm.h"
 
 #include "src/common/bitstring.h"
diff --git a/src/slurmctld/slurmctld_plugstack.c b/src/slurmctld/slurmctld_plugstack.c
index bc134d1e57ed17963cc39abf79c5e5b4afdb485c..25a2adc686b567201c9bf819a50570d2dd881011 100644
--- a/src/slurmctld/slurmctld_plugstack.c
+++ b/src/slurmctld/slurmctld_plugstack.c
@@ -36,29 +36,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c
index de253d06d5cf8b8a00b310dbfe9a34dd9bcfd508..e098781943798b7bffb2bc5c514df932882ade6f 100644
--- a/src/slurmctld/step_mgr.c
+++ b/src/slurmctld/step_mgr.c
@@ -42,16 +42,15 @@
 #  include "config.h"
 #endif
 
-#include <time.h>
 #include <ctype.h>
 #include <errno.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/param.h>
-#include <string.h>
-#include <strings.h>
+#include <time.h>
 #include <unistd.h>
 
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmd/common/reverse_tree_math.h b/src/slurmd/common/reverse_tree_math.h
index 40d7bc6e7bbaa63610ca20035470d77435e5fabf..294779c96c7173d18a8c8791ef53bdb1a1afc6ab 100644
--- a/src/slurmd/common/reverse_tree_math.h
+++ b/src/slurmd/common/reverse_tree_math.h
@@ -44,16 +44,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 #include "src/slurmd/common/reverse_tree.h"
 
diff --git a/src/slurmd/common/xcgroup.c b/src/slurmd/common/xcgroup.c
index ba164a024410d0e7e93c211a15875f03aae78acb..617d9b1a1620676180e07133e0a2497233bf69c2 100644
--- a/src/slurmd/common/xcgroup.c
+++ b/src/slurmd/common/xcgroup.c
@@ -38,23 +38,16 @@
 #   include "config.h"
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#include <dirent.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
-#include <dirent.h>
+#include <sys/file.h>
 #include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmd/common/xcpuinfo.c b/src/slurmd/common/xcpuinfo.c
index 8f325544ac9212075d744236a93f4239fc341ad8..819afd96bf22c1448fee7de2ef30992285dd09cc 100644
--- a/src/slurmd/common/xcpuinfo.c
+++ b/src/slurmd/common/xcpuinfo.c
@@ -36,27 +36,21 @@
 \*****************************************************************************/
 
 #if HAVE_CONFIG_H
-#   include "config.h"
+#  include "config.h"
 #endif
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <inttypes.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmd/slurmd/get_mach_stat.h b/src/slurmd/slurmd/get_mach_stat.h
index 951586419de85b00e84730993a29641b4aa75ab0..323b825df1f1a697aa72a33fce35dd04c736e904 100644
--- a/src/slurmd/slurmd/get_mach_stat.h
+++ b/src/slurmd/slurmd/get_mach_stat.h
@@ -40,16 +40,9 @@
 #define _GET_MACH_STAT_H
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif  /*  HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 
 extern int get_cpu_load(uint32_t *cpu_load);
 extern int get_free_mem(uint32_t *free_mem);
diff --git a/src/slurmd/slurmd/slurmd.h b/src/slurmd/slurmd/slurmd.h
index 68970f4116be7faa0107a6e471a4b1cbb246cca2..efd4e7d79da80336bb132b0c78576020f9230e1d 100644
--- a/src/slurmd/slurmd/slurmd.h
+++ b/src/slurmd/slurmd/slurmd.h
@@ -41,17 +41,9 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif			/* HAVE_INTTYPES_H */
-#else				/* !HAVE_CONFIG_H */
-#  include <inttypes.h>
-#endif				/*  HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <pthread.h>
 #include <sys/types.h>
 
diff --git a/src/slurmd/slurmd/slurmd_plugstack.c b/src/slurmd/slurmd/slurmd_plugstack.c
index 3dbab18ad95cc986b366c3b288bb9f50bbb6cb8f..9d9d3a72a8d55c947bef9baa71728573d50acb1f 100644
--- a/src/slurmd/slurmd/slurmd_plugstack.c
+++ b/src/slurmd/slurmd/slurmd_plugstack.c
@@ -36,29 +36,13 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#  if STDC_HEADERS
-#    include <string.h>
-#  endif
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif /* HAVE_SYS_TYPES_H */
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif
-#  if HAVE_INTTYPES_H
-#    include <inttypes.h>
-#  else /* ! HAVE_INTTYPES_H */
-#    if HAVE_STDINT_H
-#      include <stdint.h>
-#    endif
-#  endif /* HAVE_INTTYPES_H */
-#else /* ! HAVE_CONFIG_H */
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <stdint.h>
-#  include <string.h>
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/slurmdbd/read_config.h b/src/slurmdbd/read_config.h
index c80b52067b9de03d0c4bb166e0a3d9bd5dc7ce1d..b73294a9a0c7858fb5e557a1dbbf7dd144f3f960 100644
--- a/src/slurmdbd/read_config.h
+++ b/src/slurmdbd/read_config.h
@@ -42,19 +42,12 @@
 
 #if HAVE_CONFIG_H
 #  include "config.h"
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-#else   /* !HAVE_CONFIG_H */
-#include <stdint.h>
-#endif  /* HAVE_CONFIG_H */
+#endif
 
+#include <inttypes.h>
 #include <time.h>
 #include <pthread.h>
+
 #include "src/common/list.h"
 
 #define DEFAULT_SLURMDBD_AUTHTYPE	"auth/none"
diff --git a/src/smap/smap.h b/src/smap/smap.h
index 605a28b8009e2c43d0454ec58794fd9ea24f5379..adad2486340520676b171cf977965bd134f22c0f 100644
--- a/src/smap/smap.h
+++ b/src/smap/smap.h
@@ -48,20 +48,6 @@
 #  include "config.h"
 #endif
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else				/* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif				/* HAVE_INTTYPES_H */
-
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 /*
  * The following define is necessary for OS X 10.6. The apple supplied
  * ncurses.h sets NCURSES_OPAQUE to 1 and then we can't get to the WINDOW
@@ -90,14 +76,17 @@
 #ifdef lines
 #  undef lines
 #endif
+
 #ifndef SYSTEM_DIMENSIONS
 #  define SYSTEM_DIMENSIONS 1
 #endif
 
-#include <stdlib.h>
-#include <pwd.h>
 #include <ctype.h>
+#include <getopt.h>
+#include <inttypes.h>
+#include <pwd.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
diff --git a/src/sprio/opts.c b/src/sprio/opts.c
index 07579b756b0fe1deae85711b8acead6a2f6dc26d..bde0e29e125cfb745ab6ee9c73ea8dce54d88a33 100644
--- a/src/sprio/opts.c
+++ b/src/sprio/opts.c
@@ -44,12 +44,7 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <pwd.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/sprio/sprio.c b/src/sprio/sprio.c
index 63905c39c3629403abdf864576cfb899978e4ca3..138f414d75e1ec9caf5f667d9279658d9fb3edf1 100644
--- a/src/sprio/sprio.c
+++ b/src/sprio/sprio.c
@@ -40,14 +40,6 @@
 #  include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#if HAVE_STDINT_H
-#  include <stdint.h>
-#endif
-
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#endif
-
 #ifdef HAVE_TERMCAP_H
 #  include <termcap.h>
 #endif
diff --git a/src/sprio/sprio.h b/src/sprio/sprio.h
index 8d35e13b5000224ed6295cfc8fddbc980d0fce58..48699c2054a7ba45ec5330b2d9f71c2b1b0da8bc 100644
--- a/src/sprio/sprio.h
+++ b/src/sprio/sprio.h
@@ -44,16 +44,8 @@
 #endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
-
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
diff --git a/src/squeue/opts.c b/src/squeue/opts.c
index 3ed69f61ff5b9523a2ff1b1f65ccab95758200e2..8c0e4f787eea8debf95cec63b25e00f41b6a6527 100644
--- a/src/squeue/opts.c
+++ b/src/squeue/opts.c
@@ -46,12 +46,7 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <pwd.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/squeue/squeue.h b/src/squeue/squeue.h
index f8842062402204d92ba40e215d1b1fb1140e052a..94ed194c846af9f5fb3bd7d1f1d8f910dc402a8b 100644
--- a/src/squeue/squeue.h
+++ b/src/squeue/squeue.h
@@ -45,16 +45,8 @@
 #endif
 
 #include <ctype.h>
+#include <inttypes.h>
 #include <stdio.h>
-
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
diff --git a/src/sreport/sreport.h b/src/sreport/sreport.h
index a513efae156a7efd28e474994d7f5322de236dfb..412a28f58f9fa3808b78d234683bc794965564be 100644
--- a/src/sreport/sreport.h
+++ b/src/sreport/sreport.h
@@ -45,22 +45,13 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 
@@ -69,14 +60,6 @@
 #  include <readline/history.h>
 #endif
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include "slurm/slurm.h"
 #include "slurm/slurmdb.h"
 
diff --git a/src/srun/libsrun/opt.c b/src/srun/libsrun/opt.c
index b2859647372e77ba60eb4241fd208044640428f1..9f13978ac66ee61504d269fd061a2aac3d3aa129 100644
--- a/src/srun/libsrun/opt.c
+++ b/src/srun/libsrun/opt.c
@@ -42,31 +42,21 @@
 #  include "config.h"
 #endif
 
-#include <string.h>		/* strcpy, strncasecmp */
-#include <ctype.h>      /* isdigit() */
-
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
-
 #ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #ifdef HAVE_LIMITS_H
 #  include <limits.h>
 #endif
 
+#include <ctype.h>		/* isdigit() */
 #include <fcntl.h>
+#include <getopt.h>
 #include <stdarg.h>		/* va_start   */
 #include <stdio.h>
 #include <stdlib.h>		/* getenv     */
+#include <string.h>		/* strcpy, strncasecmp */
 #include <sys/param.h>		/* MAXPATHLEN */
 #include <sys/stat.h>
 #include <sys/types.h>
diff --git a/src/sshare/sshare.h b/src/sshare/sshare.h
index 3dc2facaaecd4ed908db7f1b3ce36232cf83ef54..759ce92ac5162588a0967a4c2402d20710bff65d 100644
--- a/src/sshare/sshare.h
+++ b/src/sshare/sshare.h
@@ -44,22 +44,13 @@
 #  include "config.h"
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-#  include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 
@@ -68,14 +59,6 @@
 #  include <readline/history.h>
 #endif
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else  /* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif  /* HAVE_INTTYPES_H */
-
 #include "slurm/slurm.h"
 
 #include "src/common/parse_time.h"
diff --git a/src/sstat/sstat.h b/src/sstat/sstat.h
index e6c8eb6e210166aabfff01b8e30c9c624824a7c7..8f938fe3b2ce7a99c33089f665001430c225b6b6 100644
--- a/src/sstat/sstat.h
+++ b/src/sstat/sstat.h
@@ -41,6 +41,7 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
 #include <grp.h>
 #include <pwd.h>
 #include <stdio.h>
@@ -52,7 +53,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "src/common/getopt.h"
 #include "src/common/xmalloc.h"
 #include "src/common/xstring.h"
 #include "src/common/list.h"
diff --git a/src/strigger/opts.c b/src/strigger/opts.c
index df2500528d17f890fee5aa8d26feb0e741667e51..462dc70fdceb7447a0141fffb07def9580281bb1 100644
--- a/src/strigger/opts.c
+++ b/src/strigger/opts.c
@@ -45,12 +45,7 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
+#include <getopt.h>
 #include <limits.h>
 #include <pwd.h>
 #include <stdlib.h>
diff --git a/src/strigger/strigger.c b/src/strigger/strigger.c
index ce58fba22a1236786f299fdbb0da4fcbec0bf13f..05b59638f2eaef0d316fedcfe9f1fdac97152eb6 100644
--- a/src/strigger/strigger.c
+++ b/src/strigger/strigger.c
@@ -46,13 +46,12 @@
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_STRINGS_H
-#  include <strings.h>
-#endif
+#include <time.h>
+#include <unistd.h>
+
 #include "slurm/slurm_errno.h"
 #include "slurm/slurm.h"
 
diff --git a/src/sview/sview.h b/src/sview/sview.h
index c491e724262c1f93534602a06d1309f0eb4c0c87..b121d7ac659af083ac1f479cbccb8ffcf427db01 100644
--- a/src/sview/sview.h
+++ b/src/sview/sview.h
@@ -36,21 +36,9 @@
 #  include "config.h"
 #endif
 
-#if HAVE_INTTYPES_H
-#  include <inttypes.h>
-#else				/* !HAVE_INTTYPES_H */
-#  if HAVE_STDINT_H
-#    include <stdint.h>
-#  endif
-#endif				/* HAVE_INTTYPES_H */
-
-#if HAVE_GETOPT_H
-#  include <getopt.h>
-#else
-#  include "src/common/getopt.h"
-#endif
-
 #include <ctype.h>
+#include <inttypes.h>
+#include <getopt.h>
 #include <pwd.h>
 #include <stdlib.h>
 #include <stdio.h>