From 3cc301c26579e0f26745eade52cb348cb3977000 Mon Sep 17 00:00:00 2001
From: "Kurt A. O'Hearn" <ohearnk@msu.edu>
Date: Wed, 20 Feb 2019 12:05:01 -0500
Subject: [PATCH] Fix build issue where config.h.in is only generated once (for
 sPuReMD) => common file across all versions.

---
 PG-PuReMD/src/reax_types.h | 2 +-
 PuReMD-GPU/src/mytypes.h   | 2 +-
 PuReMD/src/reax_types.h    | 2 +-
 common/include/.gitkeep    | 0
 configure.ac               | 5 +----
 sPuReMD/src/reax_types.h   | 2 +-
 6 files changed, 5 insertions(+), 8 deletions(-)
 create mode 100644 common/include/.gitkeep

diff --git a/PG-PuReMD/src/reax_types.h b/PG-PuReMD/src/reax_types.h
index 85f205bd..eeb1ae5b 100644
--- a/PG-PuReMD/src/reax_types.h
+++ b/PG-PuReMD/src/reax_types.h
@@ -41,7 +41,7 @@
 
 #if (defined(HAVE_CONFIG_H) && !defined(__CONFIG_H_))
   #define __CONFIG_H_
-  #include "config.h"
+  #include "../../common/include/config.h"
 #endif
 
 #include <ctype.h>
diff --git a/PuReMD-GPU/src/mytypes.h b/PuReMD-GPU/src/mytypes.h
index b04a9de3..82f9339d 100644
--- a/PuReMD-GPU/src/mytypes.h
+++ b/PuReMD-GPU/src/mytypes.h
@@ -46,7 +46,7 @@
 
 #if (defined(HAVE_CONFIG_H) && !defined(__CONFIG_H_))
   #define __CONFIG_H_
-  #include "config.h"
+  #include "../../common/include/config.h"
 #endif
 
 #include <math.h>
diff --git a/PuReMD/src/reax_types.h b/PuReMD/src/reax_types.h
index 136a5ff5..9222c65e 100644
--- a/PuReMD/src/reax_types.h
+++ b/PuReMD/src/reax_types.h
@@ -24,7 +24,7 @@
 
 #if (defined(HAVE_CONFIG_H) && !defined(__CONFIG_H_))
   #define __CONFIG_H_
-  #include "config.h"
+  #include "../../common/include/config.h"
 #endif
 
 #include <ctype.h>
diff --git a/common/include/.gitkeep b/common/include/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/configure.ac b/configure.ac
index a7f54a52..a5712602 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,7 @@ AC_LANG([C++])
 AC_PROG_CXX([icpc g++ clang++ CC c++])
 AC_PROG_CXXCPP
 
+AC_CONFIG_HEADERS([common/include/config.h])
 
 # sPuReMD
 if test "x${pack_serial_enabled}" = "xyes" || test "x${pack_openmp_enabled}" = "xyes"; then
@@ -128,7 +129,6 @@ if test "x${pack_serial_enabled}" = "xyes" || test "x${pack_openmp_enabled}" = "
 	AC_LANG_PUSH([C])
 
 	AC_CONFIG_SRCDIR([sPuReMD/src/traj.h])
-	AC_CONFIG_HEADERS([sPuReMD/src/config.h])
 
 	# Checks for libraries.
 	AC_SEARCH_LIBS([exp], [m])
@@ -249,7 +249,6 @@ if test "x${pack_gpu_enabled}" = "xyes"; then
 	AC_LANG_PUSH([C])
 
 	AC_CONFIG_SRCDIR([PuReMD-GPU/src/analyze.c])
-	AC_CONFIG_HEADERS([PuReMD-GPU/src/config.h])
 
 	# Checks for libraries.
 	AC_SEARCH_LIBS([exp], [m])
@@ -356,7 +355,6 @@ if test "x${pack_mpi_old_enabled}" = "xyes"; then
 	AC_LANG_PUSH([C])
 
 	AC_CONFIG_SRCDIR([PuReMD/src/torsion_angles.h])
-	AC_CONFIG_HEADERS([PuReMD/src/config.h])
 
 	# Checks for libraries.
 	AC_SEARCH_LIBS([exp], [m])
@@ -519,7 +517,6 @@ if test "x${pack_mpi_enabled}" = "xyes" || test "x${pack_mpi_gpu_enabled}" = "xy
 	AC_LANG_PUSH([C])
 
 	AC_CONFIG_SRCDIR([PG-PuReMD/src/torsion_angles.h])
-	AC_CONFIG_HEADERS([PG-PuReMD/src/config.h])
 
 	# Checks for libraries.
 	AC_SEARCH_LIBS([exp], [m])
diff --git a/sPuReMD/src/reax_types.h b/sPuReMD/src/reax_types.h
index 2412eee4..13424024 100644
--- a/sPuReMD/src/reax_types.h
+++ b/sPuReMD/src/reax_types.h
@@ -24,7 +24,7 @@
 
 #if (defined(HAVE_CONFIG_H) && !defined(__CONFIG_H_))
   #define __CONFIG_H_
-  #include "config.h"
+  #include "../../common/include/config.h"
 #endif
 
 #include <math.h>
-- 
GitLab