From 0cc6d529825ee7ad5a2a81a1876079d17a2a6a17 Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Tue, 19 Apr 2016 19:47:45 -0400
Subject: [PATCH] Remove HAVE_CONFIG_H conditions from src/common

Always include "config.h".

Rearrange standard library includes while here, and clean up some additional
ifdef contamination missed on the first pass.
---
 src/common/assoc_mgr.h                        |  4 +-
 src/common/bitstring.h                        |  4 +-
 src/common/callerid.c                         |  4 +-
 src/common/cbuf.c                             |  4 +-
 src/common/cpu_frequency.c                    |  6 +--
 src/common/daemonize.c                        |  6 +--
 src/common/eio.c                              |  7 ++-
 src/common/env.c                              |  4 +-
 src/common/fd.c                               |  5 +-
 src/common/fd.h                               |  6 +--
 src/common/forward.c                          |  4 +-
 src/common/gres.c                             |  5 +-
 src/common/hostlist.c                         |  4 +-
 src/common/io_hdr.c                           |  4 +-
 src/common/io_hdr.h                           |  4 +-
 src/common/job_options.c                      |  4 +-
 src/common/job_options.h                      |  4 +-
 src/common/job_resources.h                    |  4 +-
 src/common/list.c                             |  8 ++-
 src/common/log.c                              | 10 ++--
 src/common/log.h                              |  4 +-
 src/common/macros.h                           |  6 +--
 src/common/mpi.c                              |  6 +--
 src/common/msg_aggr.c                         |  4 +-
 src/common/node_conf.c                        |  4 +-
 src/common/node_conf.h                        |  4 +-
 src/common/node_features.c                    |  4 +-
 src/common/node_select.c                      |  6 +--
 src/common/node_select.h                      |  4 +-
 src/common/optz.c                             |  4 +-
 src/common/optz.h                             |  4 +-
 src/common/pack.c                             |  8 ++-
 src/common/pack.h                             |  4 +-
 src/common/parse_config.c                     |  4 +-
 src/common/parse_spec.c                       |  8 ++-
 src/common/parse_spec.h                       |  4 +-
 src/common/parse_time.c                       |  4 +-
 src/common/parse_time.h                       |  5 +-
 src/common/plugin.c                           |  8 ++-
 src/common/plugin.h                           |  4 +-
 src/common/plugrack.c                         | 52 +++----------------
 src/common/plugstack.c                        | 12 ++---
 src/common/plugstack.h                        |  4 +-
 src/common/power.h                            |  6 +--
 src/common/print_fields.h                     |  6 +--
 src/common/proc_args.c                        |  9 +---
 src/common/proc_args.h                        |  5 +-
 src/common/read_config.c                      |  4 +-
 src/common/safeopen.c                         |  9 +---
 src/common/slurm_accounting_storage.c         |  4 +-
 src/common/slurm_acct_gather.h                |  4 +-
 src/common/slurm_acct_gather_energy.h         |  4 +-
 src/common/slurm_acct_gather_filesystem.h     |  4 +-
 src/common/slurm_acct_gather_infiniband.h     |  4 +-
 src/common/slurm_acct_gather_profile.h        |  4 +-
 src/common/slurm_auth.h                       |  7 +--
 src/common/slurm_cred.c                       |  4 +-
 src/common/slurm_cred.h                       |  8 +--
 src/common/slurm_errno.c                      |  4 +-
 src/common/slurm_ext_sensors.h                |  4 +-
 src/common/slurm_jobacct_gather.h             |  4 +-
 src/common/slurm_jobcomp.c                    |  4 +-
 src/common/slurm_jobcomp.h                    |  4 +-
 src/common/slurm_mcs.h                        |  4 +-
 src/common/slurm_mpi.h                        |  5 +-
 src/common/slurm_priority.h                   |  4 +-
 src/common/slurm_protocol_api.c               |  4 +-
 src/common/slurm_protocol_api.h               |  4 +-
 src/common/slurm_protocol_common.h            |  4 +-
 src/common/slurm_protocol_defs.c              | 11 ++--
 src/common/slurm_protocol_defs.h              |  4 +-
 src/common/slurm_protocol_interface.h         |  4 +-
 src/common/slurm_protocol_pack.c              |  4 +-
 src/common/slurm_protocol_pack.h              |  4 +-
 src/common/slurm_protocol_socket_common.h     |  4 +-
 .../slurm_protocol_socket_implementation.c    | 19 +++----
 src/common/slurm_protocol_util.h              |  4 +-
 src/common/slurm_resource_info.c              |  8 +--
 src/common/slurm_resource_info.h              |  4 +-
 src/common/slurm_step_layout.c                | 10 +---
 src/common/slurm_step_layout.h                |  4 +-
 src/common/slurm_time.c                       |  4 +-
 src/common/slurm_xlator.h                     |  4 +-
 src/common/slurmdbd_defs.c                    |  4 +-
 src/common/slurmdbd_defs.h                    |  4 +-
 src/common/strlcpy.c                          | 11 ++--
 src/common/strlcpy.h                          | 20 ++++---
 src/common/switch.h                           |  6 +--
 src/common/util-net.c                         |  5 +-
 src/common/util-net.h                         |  6 +--
 src/common/xassert.c                          |  6 +--
 src/common/xassert.h                          |  4 +-
 src/common/xcgroup_read_config.h              |  4 +-
 src/common/xmalloc.c                          |  6 +--
 src/common/xsignal.c                          |  4 +-
 src/common/xstring.c                          |  4 +-
 96 files changed, 159 insertions(+), 408 deletions(-)

diff --git a/src/common/assoc_mgr.h b/src/common/assoc_mgr.h
index 382cc7f4a80..0570d33e492 100644
--- a/src/common/assoc_mgr.h
+++ b/src/common/assoc_mgr.h
@@ -44,9 +44,7 @@
 #ifndef _SLURM_ASSOC_MGR_H
 #define _SLURM_ASSOC_MGR_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include "src/common/list.h"
 #include "src/common/slurm_accounting_storage.h"
diff --git a/src/common/bitstring.h b/src/common/bitstring.h
index 42e37c5aaf8..0f337493f18 100644
--- a/src/common/bitstring.h
+++ b/src/common/bitstring.h
@@ -57,9 +57,7 @@
 #ifndef _BITSTRING_H_
 #define	_BITSTRING_H_
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/callerid.c b/src/common/callerid.c
index 878cac4d0a4..35101612c50 100644
--- a/src/common/callerid.c
+++ b/src/common/callerid.c
@@ -34,9 +34,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
diff --git a/src/common/cbuf.c b/src/common/cbuf.c
index 85af0486dba..4461104ea20 100644
--- a/src/common/cbuf.c
+++ b/src/common/cbuf.c
@@ -36,9 +36,7 @@
  *****************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #include <assert.h>
 #include <errno.h>
diff --git a/src/common/cpu_frequency.c b/src/common/cpu_frequency.c
index adf715d5c4f..08514bb3b52 100644
--- a/src/common/cpu_frequency.c
+++ b/src/common/cpu_frequency.c
@@ -37,17 +37,15 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "slurm/slurm.h"
 
diff --git a/src/common/daemonize.c b/src/common/daemonize.c
index b84a839bed1..a423af9e53c 100644
--- a/src/common/daemonize.c
+++ b/src/common/daemonize.c
@@ -36,15 +36,13 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include <fcntl.h>
-#include <unistd.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include "src/common/daemonize.h"
 #include "src/common/fd.h"
diff --git a/src/common/eio.c b/src/common/eio.c
index 93ec62ef0cd..a9fc0abe71e 100644
--- a/src/common/eio.c
+++ b/src/common/eio.c
@@ -35,15 +35,14 @@
  *  with SLURM; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
 
+#include <config.h>
+
+#include <errno.h>
 #include <poll.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <unistd.h>
-#include <errno.h>
 
 #include "src/common/fd.h"
 #include "src/common/eio.h"
diff --git a/src/common/env.c b/src/common/env.c
index debf307e556..01e586a131b 100644
--- a/src/common/env.c
+++ b/src/common/env.c
@@ -37,9 +37,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <fcntl.h>
 #include <poll.h>
diff --git a/src/common/fd.c b/src/common/fd.c
index 9c4a413ee4b..90833168a29 100644
--- a/src/common/fd.c
+++ b/src/common/fd.c
@@ -35,10 +35,7 @@
  *  Refer to "fd.h" for documentation on public functions.
 \*****************************************************************************/
 
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #include <assert.h>
 #include <errno.h>
diff --git a/src/common/fd.h b/src/common/fd.h
index 37c7c6511d9..f8edbfa305c 100644
--- a/src/common/fd.h
+++ b/src/common/fd.h
@@ -35,14 +35,10 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-
 #ifndef _FD_H
 #define _FD_H
 
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #include <fcntl.h>
 #include <sys/stat.h>
diff --git a/src/common/forward.c b/src/common/forward.c
index 5935172a205..0d6457430a3 100644
--- a/src/common/forward.c
+++ b/src/common/forward.c
@@ -37,9 +37,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <errno.h>
 #include <pthread.h>
diff --git a/src/common/gres.c b/src/common/gres.c
index d71f30390f4..9497a6c13ef 100644
--- a/src/common/gres.c
+++ b/src/common/gres.c
@@ -37,10 +37,9 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
+#include "config.h"
+
 #define _GNU_SOURCE
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
 
 #ifdef __FreeBSD__
 #  include <sys/param.h>
diff --git a/src/common/hostlist.c b/src/common/hostlist.c
index 01ea2e78a40..45cd7b7f838 100644
--- a/src/common/hostlist.c
+++ b/src/common/hostlist.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <assert.h>
 #include <ctype.h>
diff --git a/src/common/io_hdr.c b/src/common/io_hdr.c
index 5fda5665c6f..ecb796daa7d 100644
--- a/src/common/io_hdr.c
+++ b/src/common/io_hdr.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include "src/common/fd.h"
 #include "src/common/io_hdr.h"
diff --git a/src/common/io_hdr.h b/src/common/io_hdr.h
index 75b547be0ac..fd4928a3825 100644
--- a/src/common/io_hdr.h
+++ b/src/common/io_hdr.h
@@ -39,9 +39,7 @@
 #ifndef _HAVE_IO_HDR_H
 #define _HAVE_IO_HDR_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/job_options.c b/src/common/job_options.c
index 3787bdd945f..9cbb316e931 100644
--- a/src/common/job_options.c
+++ b/src/common/job_options.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include "slurm/slurm.h"
 #include "src/common/xassert.h"
diff --git a/src/common/job_options.h b/src/common/job_options.h
index c89b41ab821..7723dff83a4 100644
--- a/src/common/job_options.h
+++ b/src/common/job_options.h
@@ -39,9 +39,7 @@
 #ifndef _JOB_OPTIONS_H
 #define _JOB_OPTIONS_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include "src/common/pack.h"
 
diff --git a/src/common/job_resources.h b/src/common/job_resources.h
index 170bd28e95b..6c8456ec51d 100644
--- a/src/common/job_resources.h
+++ b/src/common/job_resources.h
@@ -39,9 +39,7 @@
 #ifndef _JOB_RESOURCES_H
 #define _JOB_RESOURCES_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/list.c b/src/common/list.c
index db9ed3af420..2947b1f6931 100644
--- a/src/common/list.c
+++ b/src/common/list.c
@@ -35,10 +35,7 @@
  *  Refer to "list.h" for documentation on public functions.
  *****************************************************************************/
 
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #include <assert.h>
 #include <errno.h>
@@ -46,10 +43,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
 #include "list.h"
+#include "log.h"
 #include "macros.h"
 #include "xmalloc.h"
-#include "src/common/log.h"
 
 /*
 ** Define slurm-specific aliases for use by plugins, see slurm_xlator.h
diff --git a/src/common/log.c b/src/common/log.c
index 6a69e3c0f15..19c37e70c40 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -50,16 +50,14 @@
 #  define _GNU_SOURCE
 #endif
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
+#include <errno.h>
+#include <poll.h>
+#include <pthread.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
-#include <errno.h>
-#include <pthread.h>
-#include <poll.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/time.h>
diff --git a/src/common/log.h b/src/common/log.h
index d8a96fd2f9d..c906863c139 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -46,9 +46,7 @@
 #ifndef _LOG_H
 #define _LOG_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #ifdef HAVE_SYS_SYSLOG_H
 #  include <sys/syslog.h>
diff --git a/src/common/macros.h b/src/common/macros.h
index 3242560ea5f..507c1ff6aaf 100644
--- a/src/common/macros.h
+++ b/src/common/macros.h
@@ -37,11 +37,9 @@
 \*****************************************************************************/
 
 #ifndef _MACROS_H
-#define _MACROS_H 	1
+#define _MACROS_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <errno.h>              /* for errno   */
 #include <pthread.h>
diff --git a/src/common/mpi.c b/src/common/mpi.c
index a31ffb5d51f..28b4b71d26b 100644
--- a/src/common/mpi.c
+++ b/src/common/mpi.c
@@ -36,12 +36,10 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
-#include <unistd.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "src/common/env.h"
 #include "src/common/macros.h"
diff --git a/src/common/msg_aggr.c b/src/common/msg_aggr.c
index 84221f94b6b..cef0356b04c 100644
--- a/src/common/msg_aggr.c
+++ b/src/common/msg_aggr.c
@@ -39,9 +39,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <pthread.h>
 
diff --git a/src/common/node_conf.c b/src/common/node_conf.c
index e0b1d9464c8..7abc8988674 100644
--- a/src/common/node_conf.c
+++ b/src/common/node_conf.c
@@ -43,9 +43,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <ctype.h>
 #include <errno.h>
diff --git a/src/common/node_conf.h b/src/common/node_conf.h
index 771cb76d2d9..0aa6eb02d36 100644
--- a/src/common/node_conf.h
+++ b/src/common/node_conf.h
@@ -42,9 +42,7 @@
 #ifndef _HAVE_NODE_CONF_H
 #define _HAVE_NODE_CONF_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <time.h>
diff --git a/src/common/node_features.c b/src/common/node_features.c
index 7954a404934..877b0b9f98e 100644
--- a/src/common/node_features.c
+++ b/src/common/node_features.c
@@ -35,9 +35,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <string.h>
diff --git a/src/common/node_select.c b/src/common/node_select.c
index 84906bdeba3..0782830ab07 100644
--- a/src/common/node_select.c
+++ b/src/common/node_select.c
@@ -45,12 +45,10 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
-#include <pthread.h>
 #include <dirent.h>
+#include <pthread.h>
 
 #include "src/common/list.h"
 #include "src/common/node_select.h"
diff --git a/src/common/node_select.h b/src/common/node_select.h
index d682071018d..076b90dc086 100644
--- a/src/common/node_select.h
+++ b/src/common/node_select.h
@@ -40,9 +40,7 @@
 #ifndef _NODE_SELECT_H
 #define _NODE_SELECT_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/common/optz.c b/src/common/optz.c
index eb7e3c13527..588731e8c4e 100644
--- a/src/common/optz.c
+++ b/src/common/optz.c
@@ -35,9 +35,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include "config.h"
 
 #include <string.h>
 
diff --git a/src/common/optz.h b/src/common/optz.h
index 708ebdfefac..2d9e2ab20ea 100644
--- a/src/common/optz.h
+++ b/src/common/optz.h
@@ -38,9 +38,7 @@
 #ifndef _OPTZ_H
 #define _OPTZ_H
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include "config.h"
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
diff --git a/src/common/pack.c b/src/common/pack.c
index 591c6a8d436..c817b472ace 100644
--- a/src/common/pack.c
+++ b/src/common/pack.c
@@ -39,16 +39,14 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
-#include <stdlib.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <netinet/in.h>
+#include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <inttypes.h>
 
 #include "slurm/slurm_errno.h"
 
diff --git a/src/common/pack.h b/src/common/pack.h
index 54413317451..71f817dc13d 100644
--- a/src/common/pack.h
+++ b/src/common/pack.h
@@ -41,9 +41,7 @@
 #ifndef _PACK_INCLUDED
 #define _PACK_INCLUDED
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <assert.h>
 #include <inttypes.h>
diff --git a/src/common/parse_config.c b/src/common/parse_config.c
index 8bb15b7e0c1..0d802fa4123 100644
--- a/src/common/parse_config.c
+++ b/src/common/parse_config.c
@@ -39,9 +39,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <ctype.h>
 #include <regex.h>
diff --git a/src/common/parse_spec.c b/src/common/parse_spec.c
index e10e6a5e6e7..ede836b29e1 100644
--- a/src/common/parse_spec.c
+++ b/src/common/parse_spec.c
@@ -36,20 +36,18 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
 
+#include <ctype.h>
+#include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
-#include <errno.h>
 
 #include "src/common/log.h"
 #include "src/common/parse_spec.h"
diff --git a/src/common/parse_spec.h b/src/common/parse_spec.h
index 201527ffd4c..3ed24a3cda1 100644
--- a/src/common/parse_spec.h
+++ b/src/common/parse_spec.h
@@ -39,9 +39,7 @@
 #ifndef _SLURM_PARSE_H_
 #define	_SLURM_PARSE_H_
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/parse_time.c b/src/common/parse_time.c
index 86db6286eaf..ed4e8d2c092 100644
--- a/src/common/parse_time.c
+++ b/src/common/parse_time.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <limits.h>
 #include <stdio.h>
diff --git a/src/common/parse_time.h b/src/common/parse_time.h
index 775584179df..5cd2a09cc5e 100644
--- a/src/common/parse_time.h
+++ b/src/common/parse_time.h
@@ -39,12 +39,9 @@
 #ifndef _PARSE_TIME_H_
 #define _PARSE_TIME_H_
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
-
 #include <time.h>
 
 /* Convert string to equivalent time value
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 2e72f943a7a..83c05f5f6e4 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -39,15 +39,13 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
+#include <dlfcn.h>
 #include <errno.h>
-#include <sys/types.h>
 #include <stdio.h>
-#include <dlfcn.h>	/* don't know if there's an autoconf for this. */
 #include <string.h>
+#include <sys/types.h>
 
 #include "src/common/xmalloc.h"
 #include "src/common/log.h"
diff --git a/src/common/plugin.h b/src/common/plugin.h
index 2e1e57eee34..d8205d1cd68 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -39,9 +39,7 @@
 #ifndef __GENERIC_PLUGIN_H__
 #define __GENERIC_PLUGIN_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/types.h>
diff --git a/src/common/plugrack.c b/src/common/plugrack.c
index 4dca7f73133..5c134facbba 100644
--- a/src/common/plugrack.c
+++ b/src/common/plugrack.c
@@ -37,50 +37,14 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-
-#  if HAVE_DIRENT_H
-#    include <dirent.h>
-#    define NAMLEN(dirent) strlen((dirent)->d_name)
-#  else /* ! HAVE_DIRENT_H */
-#    define dirent direct
-#    define NAMLEN(dirent) (dirent)->d_namlen
-#  endif /* HAVE_DIRENT_H */
-
-#  if STDC_HEADERS
-#    include <string.h>
-#  else /* ! STDC_HEADERS */
-#    if !HAVE_STRCHR
-#      define strchr index
-#      define strrchr rindex
-char *strchr(), *strrchr();
-#    endif /* HAVE_STRCHR */
-#  endif /* STDC_HEADERS */
-
-#  if HAVE_UNISTD_H
-#    include <unistd.h>
-#  endif /* HAVE_UNISTD_H */
-#  if HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif
-#  if HAVE_SYS_STAT_H
-#    include <sys/stat.h>
-#  endif
-
-#  if HAVE_STDLIB_H
-#    include <stdlib.h>
-#  endif
-
-#else /* ! HAVE_CONFIG_H */
-#  include <dirent.h>
-#  include <string.h>
-#  include <stdlib.h>
-#  include <unistd.h>
-#  include <dirent.h>
-#  include <sys/types.h>
-#  include <sys/stat.h>
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
+
+#include <dirent.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "src/common/macros.h"
 #include "src/common/xassert.h"
diff --git a/src/common/plugstack.c b/src/common/plugstack.c
index 4f52c0cb684..1293ae75dd6 100644
--- a/src/common/plugstack.c
+++ b/src/common/plugstack.c
@@ -36,16 +36,14 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include <string.h>
 #include <ctype.h>
-#include <stdlib.h>
-#include <libgen.h>
-#include <glob.h>
 #include <dlfcn.h>
+#include <glob.h>
+#include <libgen.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "src/common/plugin.h"
 #include "src/common/xmalloc.h"
diff --git a/src/common/plugstack.h b/src/common/plugstack.h
index 9ba620c2f85..bb02d8b004f 100644
--- a/src/common/plugstack.h
+++ b/src/common/plugstack.h
@@ -38,9 +38,7 @@
 #ifndef _PLUGSTACK_H
 #define _PLUGSTACK_H
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
diff --git a/src/common/power.h b/src/common/power.h
index a7d347445a6..94699490c53 100644
--- a/src/common/power.h
+++ b/src/common/power.h
@@ -35,11 +35,9 @@
 \*****************************************************************************/
 
 #ifndef _SLURM_POWER_H
-#define _SLURM_POWER_H 	1
+#define _SLURM_POWER_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include "src/common/macros.h"
 #include "src/common/pack.h"
diff --git a/src/common/print_fields.h b/src/common/print_fields.h
index 2feae07dccb..51bec16f6b8 100644
--- a/src/common/print_fields.h
+++ b/src/common/print_fields.h
@@ -39,15 +39,13 @@
 #ifndef __PRINT_FIELDS_H__
 #define __PRINT_FIELDS_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <ctype.h>
 #include <errno.h>
+#include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
-#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 086ccfc5de0..8a81dce9b65 100644
--- a/src/common/proc_args.c
+++ b/src/common/proc_args.c
@@ -36,18 +36,12 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #ifndef __USE_ISOC99
 #define __USE_ISOC99
 #endif
 
-#ifdef HAVE_LIMITS_H
-#  include <limits.h>
-#endif
-
 #ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
 #endif
@@ -58,6 +52,7 @@
 
 #include <ctype.h>		/* isdigit    */
 #include <fcntl.h>
+#include <limits.h>
 #include <pwd.h>		/* getpwuid   */
 #include <stdarg.h>		/* va_start   */
 #include <stdio.h>
diff --git a/src/common/proc_args.h b/src/common/proc_args.h
index e9023ebc4be..619fe3d6188 100644
--- a/src/common/proc_args.h
+++ b/src/common/proc_args.h
@@ -38,10 +38,7 @@
 #ifndef _PROC_ARGS_H
 #define _PROC_ARGS_H
 
-
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/src/common/read_config.c b/src/common/read_config.c
index 5fb7ff591b3..d58c38c5158 100644
--- a/src/common/read_config.c
+++ b/src/common/read_config.c
@@ -44,9 +44,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <arpa/inet.h>
 #include <assert.h>
diff --git a/src/common/safeopen.c b/src/common/safeopen.c
index 6ad97d10561..51c62896fb8 100644
--- a/src/common/safeopen.c
+++ b/src/common/safeopen.c
@@ -35,20 +35,15 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
+#include "config.h"
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#if HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include "src/common/safeopen.h"
 #include "src/common/xassert.h"
diff --git a/src/common/slurm_accounting_storage.c b/src/common/slurm_accounting_storage.c
index 9387862020a..bd055859a4d 100644
--- a/src/common/slurm_accounting_storage.c
+++ b/src/common/slurm_accounting_storage.c
@@ -37,9 +37,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
diff --git a/src/common/slurm_acct_gather.h b/src/common/slurm_acct_gather.h
index 743a228ef84..048ef2eb933 100644
--- a/src/common/slurm_acct_gather.h
+++ b/src/common/slurm_acct_gather.h
@@ -38,9 +38,7 @@
 #ifndef __SLURM_ACCT_GATHER_H__
 #define __SLURM_ACCT_GATHER_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/slurm_acct_gather_energy.h b/src/common/slurm_acct_gather_energy.h
index d876ccaf01b..9d454e074e3 100644
--- a/src/common/slurm_acct_gather_energy.h
+++ b/src/common/slurm_acct_gather_energy.h
@@ -38,9 +38,7 @@
 #ifndef __SLURM_ACCT_GATHER_ENERGY_H__
 #define __SLURM_ACCT_GATHER_ENERGY_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/resource.h>
diff --git a/src/common/slurm_acct_gather_filesystem.h b/src/common/slurm_acct_gather_filesystem.h
index 13d45cba4f5..e4a623a2eb0 100644
--- a/src/common/slurm_acct_gather_filesystem.h
+++ b/src/common/slurm_acct_gather_filesystem.h
@@ -38,9 +38,7 @@
 #ifndef __SLURM_ACCT_GATHER_FILESYSTEM_H__
 #define __SLURM_ACCT_GATHER_FILESYSTEM_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/resource.h>
diff --git a/src/common/slurm_acct_gather_infiniband.h b/src/common/slurm_acct_gather_infiniband.h
index 85e0ed35bab..7142c09536e 100644
--- a/src/common/slurm_acct_gather_infiniband.h
+++ b/src/common/slurm_acct_gather_infiniband.h
@@ -38,9 +38,7 @@
 #ifndef __SLURM_ACCT_GATHER_INFINIBAND_H__
 #define __SLURM_ACCT_GATHER_INFINIBAND_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/resource.h>
diff --git a/src/common/slurm_acct_gather_profile.h b/src/common/slurm_acct_gather_profile.h
index 48a8ef4118a..f83eab6f940 100644
--- a/src/common/slurm_acct_gather_profile.h
+++ b/src/common/slurm_acct_gather_profile.h
@@ -39,9 +39,7 @@
 #ifndef __SLURM_ACCT_GATHER_PROFILE_H__
 #define __SLURM_ACCT_GATHER_PROFILE_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/resource.h>
diff --git a/src/common/slurm_auth.h b/src/common/slurm_auth.h
index 00f0fa17f37..f4972c55303 100644
--- a/src/common/slurm_auth.h
+++ b/src/common/slurm_auth.h
@@ -39,13 +39,10 @@
 #ifndef __SLURM_AUTHENTICATION_H__
 #define __SLURM_AUTHENTICATION_H__
 
-#include <stdio.h>
-
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
+#include <stdio.h>
 
 #include "src/common/plugrack.h"
 #include "src/common/pack.h"
diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c
index 0a10bb32dd3..4ebf9f5428c 100644
--- a/src/common/slurm_cred.c
+++ b/src/common/slurm_cred.c
@@ -38,9 +38,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <fcntl.h>
 #include <pthread.h>
diff --git a/src/common/slurm_cred.h b/src/common/slurm_cred.h
index 1c17cb91f97..052d5c6e45f 100644
--- a/src/common/slurm_cred.h
+++ b/src/common/slurm_cred.h
@@ -40,13 +40,9 @@
 #ifndef _HAVE_SLURM_CRED_H
 #define _HAVE_SLURM_CRED_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
-#if HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
+#include <unistd.h>
 
 #if HAVE_SYS_TYPES_H
 #  include <sys/types.h>
diff --git a/src/common/slurm_errno.c b/src/common/slurm_errno.c
index 688a26854a8..6038522a86c 100644
--- a/src/common/slurm_errno.c
+++ b/src/common/slurm_errno.c
@@ -44,13 +44,11 @@
  *  their description strings.
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
-#include <stdlib.h>
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "slurm/slurm_errno.h"
diff --git a/src/common/slurm_ext_sensors.h b/src/common/slurm_ext_sensors.h
index 33136621d32..37b7cedc82a 100644
--- a/src/common/slurm_ext_sensors.h
+++ b/src/common/slurm_ext_sensors.h
@@ -38,9 +38,7 @@
 #ifndef __SLURM_EXT_SENSORS_H__
 #define __SLURM_EXT_SENSORS_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/resource.h>
diff --git a/src/common/slurm_jobacct_gather.h b/src/common/slurm_jobacct_gather.h
index 163524797bc..cea02c2c2b8 100644
--- a/src/common/slurm_jobacct_gather.h
+++ b/src/common/slurm_jobacct_gather.h
@@ -50,9 +50,7 @@
 #ifndef __SLURM_JOBACCT_GATHER_H__
 #define __SLURM_JOBACCT_GATHER_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/resource.h>
diff --git a/src/common/slurm_jobcomp.c b/src/common/slurm_jobcomp.c
index 678f4dfbb7f..403e30ddf75 100644
--- a/src/common/slurm_jobcomp.c
+++ b/src/common/slurm_jobcomp.c
@@ -38,9 +38,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <pthread.h>
 #include <stdlib.h>
diff --git a/src/common/slurm_jobcomp.h b/src/common/slurm_jobcomp.h
index f7155565394..6fb8ee29b71 100644
--- a/src/common/slurm_jobcomp.h
+++ b/src/common/slurm_jobcomp.h
@@ -40,9 +40,7 @@
 #ifndef __SLURM_JOBCOMP_H__
 #define __SLURM_JOBCOMP_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/types.h>
diff --git a/src/common/slurm_mcs.h b/src/common/slurm_mcs.h
index e4cfa610a27..2683bde9d4b 100644
--- a/src/common/slurm_mcs.h
+++ b/src/common/slurm_mcs.h
@@ -37,9 +37,7 @@
 #ifndef _SLURM_MCS_H
 #define _SLURM_MCS_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/slurm_mpi.h b/src/common/slurm_mpi.h
index 12c01212341..147f43bc2db 100644
--- a/src/common/slurm_mpi.h
+++ b/src/common/slurm_mpi.h
@@ -39,11 +39,10 @@
 #ifndef _SRUN_MPI_H
 #define _SRUN_MPI_H
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
 #include <stdbool.h>
+
 #include "slurm/slurm.h"
 
 #include "src/slurmd/slurmstepd/slurmstepd_job.h"
diff --git a/src/common/slurm_priority.h b/src/common/slurm_priority.h
index 3b786af2f1d..739f1b1ad4d 100644
--- a/src/common/slurm_priority.h
+++ b/src/common/slurm_priority.h
@@ -39,9 +39,7 @@
 #ifndef _SLURM_PRIORITY_H
 #define _SLURM_PRIORITY_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c
index ed400960af7..0191b98d12f 100644
--- a/src/common/slurm_protocol_api.c
+++ b/src/common/slurm_protocol_api.c
@@ -39,9 +39,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 /* GLOBAL INCLUDES */
 
diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h
index bd8e164381d..ed85ed99f2f 100644
--- a/src/common/slurm_protocol_api.h
+++ b/src/common/slurm_protocol_api.h
@@ -42,9 +42,7 @@
 #ifndef _SLURM_PROTOCOL_API_H
 #define _SLURM_PROTOCOL_API_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/types.h>
diff --git a/src/common/slurm_protocol_common.h b/src/common/slurm_protocol_common.h
index 4c619291d48..f99a04a1a1b 100644
--- a/src/common/slurm_protocol_common.h
+++ b/src/common/slurm_protocol_common.h
@@ -40,9 +40,7 @@
 #ifndef _SLURM_PROTOCOL_COMMON_H
 #define _SLURM_PROTOCOL_COMMON_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <sys/time.h>
 #include <time.h>
diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 85a0b4b9cf4..5db869b7bc2 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -40,16 +40,11 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
-#if HAVE_STDLIB_H
-#  include <stdlib.h>
-#endif
-
-#include <stdio.h>
 #include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 #include "src/common/forward.h"
 #include "src/common/job_options.h"
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index 47dbc92aa15..be56733e80a 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -41,9 +41,7 @@
 #ifndef _SLURM_PROTOCOL_DEFS_H
 #define _SLURM_PROTOCOL_DEFS_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <sys/wait.h>
diff --git a/src/common/slurm_protocol_interface.h b/src/common/slurm_protocol_interface.h
index 244f71b8eb6..85e4fe0e718 100644
--- a/src/common/slurm_protocol_interface.h
+++ b/src/common/slurm_protocol_interface.h
@@ -39,9 +39,7 @@
 #ifndef _SLURM_PROTOCOL_INTERFACE_H
 #define _SLURM_PROTOCOL_INTERFACE_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <fcntl.h>
 #include <inttypes.h>
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index bdb7d233f8d..0322cc77c2d 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -38,9 +38,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <errno.h>
 #include <stdio.h>
diff --git a/src/common/slurm_protocol_pack.h b/src/common/slurm_protocol_pack.h
index 012d38ff380..eab68c217ce 100644
--- a/src/common/slurm_protocol_pack.h
+++ b/src/common/slurm_protocol_pack.h
@@ -40,9 +40,7 @@
 #ifndef _SLURM_PROTOCOL_PACK_H
 #define _SLURM_PROTOCOL_PACK_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/slurm_protocol_socket_common.h b/src/common/slurm_protocol_socket_common.h
index b2b053baa2e..3d0822f52e6 100644
--- a/src/common/slurm_protocol_socket_common.h
+++ b/src/common/slurm_protocol_socket_common.h
@@ -40,9 +40,7 @@
 #ifndef _SLURM_PROTOCOL_SOCKET_COMMON_H
 #define _SLURM_PROTOCOL_SOCKET_COMMON_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <netinet/in.h>
diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c
index 442af4b00ae..14d731b2046 100644
--- a/src/common/slurm_protocol_socket_implementation.c
+++ b/src/common/slurm_protocol_socket_implementation.c
@@ -38,27 +38,24 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #define _USE_IRS 1	/* Required for AIX and hstrerror() */
 
-#include <unistd.h>
-#include <string.h>
-#include <netdb.h>
+#include <arpa/inet.h>
 #include <errno.h>
+#include <netdb.h>
 #include <netinet/in.h>
 #include <poll.h>
-#include <sys/time.h>
-#include <sys/types.h>
 #include <signal.h>
-#include <stdio.h>
 #include <stdarg.h>
+#include <stdio.h>
 #include <stdlib.h>
-#include <arpa/inet.h>
+#include <string.h>
 #include <sys/param.h>
-#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #if HAVE_SYS_SOCKET_H
 #  include <sys/socket.h>
diff --git a/src/common/slurm_protocol_util.h b/src/common/slurm_protocol_util.h
index f9df1d9d09c..66b7ccec112 100644
--- a/src/common/slurm_protocol_util.h
+++ b/src/common/slurm_protocol_util.h
@@ -39,9 +39,7 @@
 #ifndef _SLURM_PROTOCOL_UTIL_H
 #define _SLURM_PROTOCOL_UTIL_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 #include <stdio.h>
diff --git a/src/common/slurm_resource_info.c b/src/common/slurm_resource_info.c
index 6ecb77f4851..3709ffb0dda 100644
--- a/src/common/slurm_resource_info.c
+++ b/src/common/slurm_resource_info.c
@@ -34,15 +34,11 @@
  *  with SLURM; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
 
-#if HAVE_STRING_H
-#  include <string.h>
-#endif
+#include "config.h"
 
 #include <ctype.h>
+#include <string.h>
 #include <sys/types.h>
 
 #include "slurm/slurm.h"
diff --git a/src/common/slurm_resource_info.h b/src/common/slurm_resource_info.h
index 1a3981a433f..99987917233 100644
--- a/src/common/slurm_resource_info.h
+++ b/src/common/slurm_resource_info.h
@@ -38,9 +38,7 @@
 #ifndef _RES_INFO_H
 #define _RES_INFO_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <stdint.h>
 
diff --git a/src/common/slurm_step_layout.c b/src/common/slurm_step_layout.c
index 0c4901d3dae..08bfd5f65fe 100644
--- a/src/common/slurm_step_layout.c
+++ b/src/common/slurm_step_layout.c
@@ -28,16 +28,10 @@
  *  Copyright (C) 2002 The Regents of the University of California.
 \*****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#  if HAVE_STRING_H
-#    include <string.h>
-#  endif
-#else                /* !HAVE_CONFIG_H */
-#  include <string.h>
-#endif                /* HAVE_CONFIG_H */
+#include "config.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "slurm/slurm.h"
 #include "slurm/slurm_errno.h"
diff --git a/src/common/slurm_step_layout.h b/src/common/slurm_step_layout.h
index 27cd2fd4cb4..d45002071ed 100644
--- a/src/common/slurm_step_layout.h
+++ b/src/common/slurm_step_layout.h
@@ -31,9 +31,7 @@
 #ifndef _SLURM_STEP_LAYOUT_H
 #define _SLURM_STEP_LAYOUT_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/slurm_time.c b/src/common/slurm_time.c
index 18919aa3efe..1886125e5e6 100644
--- a/src/common/slurm_time.c
+++ b/src/common/slurm_time.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <pthread.h>
 #include <time.h>
diff --git a/src/common/slurm_xlator.h b/src/common/slurm_xlator.h
index b92915acde0..58c9d5f94c9 100644
--- a/src/common/slurm_xlator.h
+++ b/src/common/slurm_xlator.h
@@ -66,9 +66,7 @@
 #ifndef __SLURM_XLATOR_H__
 #define __SLURM_XLATOR_H__
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #if USE_ALIAS
 
diff --git a/src/common/slurmdbd_defs.c b/src/common/slurmdbd_defs.c
index 7fad2c191f3..48e3a1101f9 100644
--- a/src/common/slurmdbd_defs.c
+++ b/src/common/slurmdbd_defs.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <arpa/inet.h>
 #include <fcntl.h>
diff --git a/src/common/slurmdbd_defs.h b/src/common/slurmdbd_defs.h
index 78f1be43f64..ee2fdeac9be 100644
--- a/src/common/slurmdbd_defs.h
+++ b/src/common/slurmdbd_defs.h
@@ -39,9 +39,7 @@
 #ifndef _SLURMDBD_DEFS_H
 #define _SLURMDBD_DEFS_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/strlcpy.c b/src/common/strlcpy.c
index 85c6bea06c9..12764c7e9f8 100644
--- a/src/common/strlcpy.c
+++ b/src/common/strlcpy.c
@@ -16,12 +16,12 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#  if (!HAVE_STRLCPY)
+#include "config.h"
+
+#if (!HAVE_STRLCPY)
 
-#include <sys/types.h>
 #include <string.h>
+#include <sys/types.h>
 
 #include "src/common/macros.h"
 #include "src/common/strlcpy.h"
@@ -63,5 +63,4 @@ strlcpy(char *dst, const char *src, size_t siz)
 	return(s - src - 1);	/* count does not include NUL */
 }
 
-#  endif /* !HAVE_STRLCPY */
-#endif /* HAVE_CONFIG_H */
+#endif /* !HAVE_STRLCPY */
diff --git a/src/common/strlcpy.h b/src/common/strlcpy.h
index fe01a87d14a..b7eecda4d97 100644
--- a/src/common/strlcpy.h
+++ b/src/common/strlcpy.h
@@ -1,19 +1,17 @@
 #ifndef _STRLCPY_H
 #define _STRLCPY_H
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#  ifndef HAVE_STRLCPY
+#ifndef HAVE_STRLCPY
 
-#     include <sys/types.h>
+#  include <sys/types.h>
+
+   /*
+    * Copy src to string dst of size siz.  At most siz-1 characters
+    * will be copied.  Always NUL terminates (unless siz == 0).
+    * Returns strlen(src); if retval >= siz, truncation occurred.
+    */
+   size_t strlcpy(char *dst, const char *src, size_t siz);
 
-      /*
-       * Copy src to string dst of size siz.  At most siz-1 characters
-       * will be copied.  Always NUL terminates (unless siz == 0).
-       * Returns strlen(src); if retval >= siz, truncation occurred.
-       */
-      size_t strlcpy(char *dst, const char *src, size_t siz);
 #  endif /* !HAVE_STRLCPY */
-#endif /* HAVE_CONFIG_H */
 
 #endif /* _STRLCPY_H */
diff --git a/src/common/switch.h b/src/common/switch.h
index b9d367b6e37..10b190a9394 100644
--- a/src/common/switch.h
+++ b/src/common/switch.h
@@ -38,11 +38,9 @@
 \*****************************************************************************/
 
 #ifndef _SWITCH_H
-#define _SWITCH_H 	1
+#define _SWITCH_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <stdio.h>
 #include <sys/types.h>
diff --git a/src/common/util-net.c b/src/common/util-net.c
index e5346d20ef4..c77ae96aed9 100644
--- a/src/common/util-net.c
+++ b/src/common/util-net.c
@@ -35,10 +35,7 @@
  *  Refer to "util-net.h" for documentation on public functions.
 \*****************************************************************************/
 
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
diff --git a/src/common/util-net.h b/src/common/util-net.h
index 66e1d7c3a36..72f4a7eb769 100644
--- a/src/common/util-net.h
+++ b/src/common/util-net.h
@@ -35,14 +35,10 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-
 #ifndef _UTIL_NET_H
 #define _UTIL_NET_H
 
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "config.h"
 
 #ifndef   _GNU_SOURCE
 #  define _GNU_SOURCE
diff --git a/src/common/xassert.c b/src/common/xassert.c
index 75827a5f56a..2ca17742715 100644
--- a/src/common/xassert.c
+++ b/src/common/xassert.c
@@ -37,12 +37,10 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "src/common/log.h"
 #include "src/common/macros.h"
diff --git a/src/common/xassert.h b/src/common/xassert.h
index 55e3b2c768c..4db7b15a728 100644
--- a/src/common/xassert.h
+++ b/src/common/xassert.h
@@ -41,9 +41,7 @@
 #ifndef _XASSERT_H
 #define _XASSERT_H	1
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include "macros.h"
 
diff --git a/src/common/xcgroup_read_config.h b/src/common/xcgroup_read_config.h
index 53cb3af9a8c..89586c53df1 100644
--- a/src/common/xcgroup_read_config.h
+++ b/src/common/xcgroup_read_config.h
@@ -37,9 +37,7 @@
 #ifndef _CGROUP_READ_CONFIG_H
 #define _CGROUP_READ_CONFIG_H
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <inttypes.h>
 
diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c
index 6367ec1305e..214f3799f15 100644
--- a/src/common/xmalloc.c
+++ b/src/common/xmalloc.c
@@ -39,15 +39,13 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <errno.h>
 #include <pthread.h>
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "src/common/log.h"
 #include "src/common/macros.h"
diff --git a/src/common/xsignal.c b/src/common/xsignal.c
index e40fa882d9a..b5270a7008a 100644
--- a/src/common/xsignal.c
+++ b/src/common/xsignal.c
@@ -36,9 +36,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <errno.h>
 #include <signal.h>
diff --git a/src/common/xstring.c b/src/common/xstring.c
index 6c17cdd61ad..d32d2ae7d59 100644
--- a/src/common/xstring.c
+++ b/src/common/xstring.c
@@ -39,9 +39,7 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 \*****************************************************************************/
 
-#if     HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
 #include <ctype.h>
 #include <errno.h>
-- 
GitLab