diff --git a/auxdir/x_ac_bluegene.m4 b/auxdir/x_ac_bluegene.m4
index 24f79e790522ec7e99feca264a8b4e688f7510f1..007c9261e088faa6ecb1475bf6b66f06a2d37e6d 100644
--- a/auxdir/x_ac_bluegene.m4
+++ b/auxdir/x_ac_bluegene.m4
@@ -90,6 +90,7 @@ AC_DEFUN([X_AC_BGL],
   	if test ! -z "$have_bg_files" ; then
       		BG_INCLUDES="$bg_includes"
 		CFLAGS="$CFLAGS -m64"
+		CXXFLAGS="$CXXFLAGS $CFLAGS"
       		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
   		AC_DEFINE(SYSTEM_DIMENSIONS, 3, [3-dimensional architecture])
       		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
@@ -175,6 +176,7 @@ AC_DEFUN([X_AC_BGP],
   	if test ! -z "$have_bgp_files" ; then
       		BG_INCLUDES="$bg_includes"
 		CFLAGS="$CFLAGS -m64"
+		CXXFLAGS="$CXXFLAGS $CFLAGS"
       		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
   		AC_DEFINE(SYSTEM_DIMENSIONS, 3, [3-dimensional architecture])
       		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
@@ -256,10 +258,11 @@ AC_DEFUN([X_AC_BGQ],
   	if test ! -z "$have_bgq_files" ; then
       		BG_INCLUDES="$bg_includes"
 		CFLAGS="$CFLAGS -m64"
+   		CXXFLAGS="$CXXFLAGS $CFLAGS"
       		AC_DEFINE(HAVE_3D, 1, [Define to 1 if 3-dimensional architecture])
   		AC_DEFINE(SYSTEM_DIMENSIONS, 3, [3-dimensional architecture])
       		AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system])
-      		AC_DEFINE(HAVE_BGQ, 1, [Define to 1 if emulating or running on Blue Gene/P system])
+      		AC_DEFINE(HAVE_BGQ, 1, [Define to 1 if emulating or running on Blue Gene/Q system])
       		AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end only])
 		AC_DEFINE(HAVE_BG_FILES, 1, [Define to 1 if have Blue Gene files])
 		AC_DEFINE_UNQUOTED(BG_BRIDGE_SO, "$soloc", [Define the BG_BRIDGE_SO value])
diff --git a/auxdir/x_ac_lua.m4 b/auxdir/x_ac_lua.m4
index 5eb1f6db6e2b071d12474c6d31c05b641b512cd4..a4efdbf8562ca916b5f4fa6f7ce9b55e7d7daa82 100644
--- a/auxdir/x_ac_lua.m4
+++ b/auxdir/x_ac_lua.m4
@@ -20,7 +20,7 @@ AC_DEFUN([X_AC_LUA],
                 [x_ac_have_lua="yes"],
                 [x_ac_have_lua="no"])
 
-	if test x"$x_ac_have_lua" = "xyes"; then
+	if test "x$x_ac_have_lua" = "xyes"; then
 	  saved_CFLAGS="$CFLAGS"
 	  saved_LDFLAGS="$LDFLAGS"
 	  CFLAGS="$CFLAGS $lua_CFLAGS"
@@ -38,7 +38,7 @@ AC_DEFUN([X_AC_LUA],
 	  AC_MSG_RESULT([$x_ac_have_lua])
 	  CFLAGS="$saved_CFLAGS"
 	  LDFLAGS="$saved_LDFLAGS"
-     fi
+	fi
 
 	AM_CONDITIONAL(HAVE_LUA, test "x$x_ac_have_lua" = "xyes")
 ])
diff --git a/config.h.in b/config.h.in
index e16aa8dcef9924375b34b98794c2b2bd2c7fbd95..f4f4071acbe8139f5a526ec86be7c591e9e20735 100644
--- a/config.h.in
+++ b/config.h.in
@@ -51,7 +51,7 @@
 /* Define to 1 if emulating or running on Blue Gene/P system */
 #undef HAVE_BGP
 
-/* Define to 1 if emulating or running on Blue Gene/P system */
+/* Define to 1 if emulating or running on Blue Gene/Q system */
 #undef HAVE_BGQ
 
 /* Define to 1 if have Blue Gene files */
diff --git a/configure b/configure
index 804560c24e486ab9425e76014a1468b93b832bea..52b4a4010bde2a72fab1a6324154b4d12a8f2908 100755
--- a/configure
+++ b/configure
@@ -4547,6 +4547,7 @@ rm -f core conftest.err conftest.$ac_objext \
   	if test ! -z "$have_bg_files" ; then
       		BG_INCLUDES="$bg_includes"
 		CFLAGS="$CFLAGS -m64"
+		CXXFLAGS="$CXXFLAGS $CFLAGS"
 
 $as_echo "#define HAVE_3D 1" >>confdefs.h
 
@@ -4695,6 +4696,7 @@ rm -f core conftest.err conftest.$ac_objext \
   	if test ! -z "$have_bgp_files" ; then
       		BG_INCLUDES="$bg_includes"
 		CFLAGS="$CFLAGS -m64"
+		CXXFLAGS="$CXXFLAGS $CFLAGS"
 
 $as_echo "#define HAVE_3D 1" >>confdefs.h
 
@@ -4832,6 +4834,7 @@ rm -f core conftest.err conftest.$ac_objext \
   	if test ! -z "$have_bgq_files" ; then
       		BG_INCLUDES="$bg_includes"
 		CFLAGS="$CFLAGS -m64"
+   		CXXFLAGS="$CXXFLAGS $CFLAGS"
 
 $as_echo "#define HAVE_3D 1" >>confdefs.h
 
@@ -7159,13 +7162,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:7162: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:7165: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:7165: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:7168: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:7168: output\"" >&5)
+  (eval echo "\"\$as_me:7171: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -8370,7 +8373,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 8373 "configure"' > conftest.$ac_ext
+  echo '#line 8376 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -10159,11 +10162,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10162: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10165: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10166: \$? = $ac_status" >&5
+   echo "$as_me:10169: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -10498,11 +10501,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10501: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10504: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10505: \$? = $ac_status" >&5
+   echo "$as_me:10508: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -10603,11 +10606,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10606: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10609: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:10610: \$? = $ac_status" >&5
+   echo "$as_me:10613: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10658,11 +10661,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10661: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10664: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:10665: \$? = $ac_status" >&5
+   echo "$as_me:10668: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13042,7 +13045,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 13045 "configure"
+#line 13048 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13138,7 +13141,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 13141 "configure"
+#line 13144 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15094,11 +15097,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15097: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15100: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15101: \$? = $ac_status" >&5
+   echo "$as_me:15104: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -15193,11 +15196,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15196: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15199: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15200: \$? = $ac_status" >&5
+   echo "$as_me:15203: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15245,11 +15248,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15248: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15251: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15252: \$? = $ac_status" >&5
+   echo "$as_me:15255: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -19870,7 +19873,7 @@ $as_echo "yes" >&6; }
 	x_ac_have_lua="yes"
 fi
 
-	if test x"$x_ac_have_lua" = "xyes"; then
+	if test "x$x_ac_have_lua" = "xyes"; then
 	  saved_CFLAGS="$CFLAGS"
 	  saved_LDFLAGS="$LDFLAGS"
 	  CFLAGS="$CFLAGS $lua_CFLAGS"
@@ -19904,7 +19907,7 @@ rm -f core conftest.err conftest.$ac_objext \
 $as_echo "$x_ac_have_lua" >&6; }
 	  CFLAGS="$saved_CFLAGS"
 	  LDFLAGS="$saved_LDFLAGS"
-     fi
+	fi
 
 	 if test "x$x_ac_have_lua" = "xyes"; then
   HAVE_LUA_TRUE=
diff --git a/src/plugins/select/bgq/Makefile.am b/src/plugins/select/bgq/Makefile.am
index 9f79558867fa3b10cdec9c6b322e815f7e8302e3..75edd24236cef9077e1538cd85911eb889a1f4cb 100644
--- a/src/plugins/select/bgq/Makefile.am
+++ b/src/plugins/select/bgq/Makefile.am
@@ -1,10 +1,11 @@
 # Makefile for select/bgq plugin
 
+CPPFLAGS = -DBLUEGENE_CONFIG_FILE=\"$(sysconfdir)/bluegene.conf\"
 AUTOMAKE_OPTIONS = foreign
 
 PLUGIN_FLAGS = -module -avoid-version --export-dynamic
 
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common $(BG_INCLUDES)
 
 pkglib_LTLIBRARIES = select_bgq.la
 
diff --git a/src/plugins/select/bgq/Makefile.in b/src/plugins/select/bgq/Makefile.in
index 2d093605c16aca286f5cf181c2c6086859f4f2a1..646bb0b8159dbecdfbf5c7e4aac5fa490a8082cd 100644
--- a/src/plugins/select/bgq/Makefile.in
+++ b/src/plugins/select/bgq/Makefile.in
@@ -157,7 +157,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CMD_LDFLAGS = @CMD_LDFLAGS@
 CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
+CPPFLAGS = -DBLUEGENE_CONFIG_FILE=\"$(sysconfdir)/bluegene.conf\"
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -327,7 +327,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
 PLUGIN_FLAGS = -module -avoid-version --export-dynamic
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common $(BG_INCLUDES)
 pkglib_LTLIBRARIES = select_bgq.la
 
 # Linear node selection plugin.
diff --git a/src/plugins/select/bluegene/plugin/Makefile.am b/src/plugins/select/bluegene/plugin/Makefile.am
index 019e5268c8d0fc581665626922e0709aecf7bc63..0d52ebad9c544dad7ccf89faa49af25d164fb8ed 100644
--- a/src/plugins/select/bluegene/plugin/Makefile.am
+++ b/src/plugins/select/bluegene/plugin/Makefile.am
@@ -1,6 +1,6 @@
 # Makefile for select/bluegene plugin
 
-CPPFLAGS =  -DBLUEGENE_CONFIG_FILE=\"$(sysconfdir)/bluegene.conf\"
+CPPFLAGS = -DBLUEGENE_CONFIG_FILE=\"$(sysconfdir)/bluegene.conf\"
 AUTOMAKE_OPTIONS = foreign
 
 PLUGIN_FLAGS = -module -avoid-version --export-dynamic -lm