Index: ThirdParty/mpqc_open/configure.ac
===================================================================
--- ThirdParty/mpqc_open/configure.ac	(revision 0035ea419537dcdf74ab59b934d0227f1cca43dc)
+++ ThirdParty/mpqc_open/configure.ac	(revision bbc9821982d085faaabde9fa52f49343777c131a)
@@ -6,21 +6,6 @@
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/bin/mpqc/mpqc.cc])
-AC_CONFIG_HEADER([src/lib/scconfig.h])
+AC_CONFIG_HEADERS([src/lib/scconfig.h])
 AC_CONFIG_MACRO_DIR([m4])
-
-# parallel-tests: use parallel test druver
-# color-tests: us coloring to indicate success/failure when available
-# tar-pax: use newer tar implementation with longer filename (>99 chars)
-AM_INIT_AUTOMAKE([dist-bzip2 1.5 tar-pax subdir-objects])
-
-# Checks for programs.
-AC_PROG_CXX
-AC_PROG_INSTALL
-
-# use doxygen
-DX_HTML_FEATURE(ON)
-DX_PS_FEATURE(OFF)
-DX_PDF_FEATURE(OFF)
-DX_INIT_DOXYGEN(MPQC, doxygen.cfg, ${docdir})
 
 # Define these substitions here to keep all version information in one place.
@@ -39,5 +24,5 @@
 define([AC_CACHE_SAVE], )dnl for debugging configure.in
 
-dnl AC_CANONICAL_SYSTEM
+AC_CANONICAL_SYSTEM
 
 AC_DEFINE_UNQUOTED(HOST_ARCH, "$host", ["host"])
@@ -63,4 +48,19 @@
 
 EXCLUDED_DIRS=
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_INSTALL
+
+# use doxygen
+DX_HTML_FEATURE(ON)
+DX_PS_FEATURE(OFF)
+DX_PDF_FEATURE(OFF)
+DX_INIT_DOXYGEN(MPQC, doxygen.cfg, ${docdir})
+
+# parallel-tests: use parallel test druver
+# color-tests: us coloring to indicate success/failure when available
+# tar-pax: use newer tar implementation with longer filename (>99 chars)
+AM_INIT_AUTOMAKE([dist-bzip2 1.5 tar-pax subdir-objects])
 
 dnl --------- Features ---------
@@ -1148,4 +1148,5 @@
 AC_LANG_RESTORE
 fi
+AM_CONDITIONAL(COND_PTHREAD, [test X$HAVE_PTHREAD = Xyes])
 
 AC_MSG_RESULT($HAVE_PTHREAD)
@@ -1154,17 +1155,29 @@
   AC_DEFINE(HAVE_PTHREAD, 1, ["use pthreads"])
   EXTRADEFINES="-D_REENTRANT $EXTRADEFINES"
-  AC_CHECK_FUNC(pthread_attr_getstacksize)
-  AC_CHECK_FUNC(pthread_attr_setstacksize)
-  AC_CHECK_FUNC(pthread_attr_setscope)
-  AC_CHECK_FUNC(pthread_attr_getscope)
-  AC_CHECK_FUNC(pthread_attr_setinheritsched)
-  AC_CHECK_FUNC(pthread_attr_getinheritsched)
-  AC_CHECK_FUNC(pthread_attr_setschedpolicy)
-  AC_CHECK_FUNC(pthread_attr_getschedpolicy)
-  AC_CHECK_FUNC(pthread_attr_setschedparam)
-  AC_CHECK_FUNC(pthread_attr_getschedparam)
-  AC_CHECK_FUNC(sched_get_priority_max)
-  AC_CHECK_FUNC(sched_get_priority_min)
-fi
+  AC_CHECK_FUNC(pthread_attr_getstacksize, [HAVE_PTHREAD_ATTR_GETINHERITSCHED=yes], [HAVE_PTHREAD_ATTR_GETINHERITSCHED=no])
+  AC_CHECK_FUNC(pthread_attr_setstacksize, [HAVE_PTHREAD_ATTR_GETSCHEDPARAM=yes], [HAVE_PTHREAD_ATTR_GETSCHEDPARAM=no])
+  AC_CHECK_FUNC(pthread_attr_setscope, [HAVE_PTHREAD_ATTR_GETSCHEDPOLICY=yes], [HAVE_PTHREAD_ATTR_GETSCHEDPOLICY=no])
+  AC_CHECK_FUNC(pthread_attr_getscope, [HAVE_PTHREAD_ATTR_GETSCOPE=yes], [HAVE_PTHREAD_ATTR_GETSCOPE=no])
+  AC_CHECK_FUNC(pthread_attr_setinheritsched, [HAVE_PTHREAD_ATTR_GETSTACKSIZE=yes], [HAVE_PTHREAD_ATTR_GETSTACKSIZE=no])
+  AC_CHECK_FUNC(pthread_attr_getinheritsched, [HAVE_PTHREAD_ATTR_SETINHERITSCHED=yes], [HAVE_PTHREAD_ATTR_SETINHERITSCHED=no])
+  AC_CHECK_FUNC(pthread_attr_setschedpolicy, [HAVE_PTHREAD_ATTR_SETSCHEDPARAM=yes], [HAVE_PTHREAD_ATTR_SETSCHEDPARAM=no])
+  AC_CHECK_FUNC(pthread_attr_getschedpolicy, [HAVE_PTHREAD_ATTR_SETSCHEDPOLICY=yes], [HAVE_PTHREAD_ATTR_SETSCHEDPOLICY=no])
+  AC_CHECK_FUNC(pthread_attr_setschedparam, [HAVE_PTHREAD_ATTR_SETSCOPE=yes], [HAVE_PTHREAD_ATTR_SETSCOPE=no])
+  AC_CHECK_FUNC(pthread_attr_getschedparam, [HAVE_PTHREAD_ATTR_SETSTACKSIZE=yes], [HAVE_PTHREAD_ATTR_SETSTACKSIZE=no])
+  AC_CHECK_FUNC(sched_get_priority_max, [HAVE_SCHED_GET_PRIORITY_MAX=yes], [HAVE_SCHED_GET_PRIORITY_MAX=no])
+  AC_CHECK_FUNC(sched_get_priority_min, [HAVE_SCHED_GET_PRIORITY_MIN=yes], [HAVE_SCHED_GET_PRIORITY_MIN=no])
+fi
+AC_DEFINE(HAVE_PTHREAD_ATTR_GETINHERITSCHED, [$HAVE_PTHREAD_ATTR_GETINHERITSCHED], ["use pthread_attr_getstacksize"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_GETSCHEDPARAM, [$HAVE_PTHREAD_ATTR_GETSCHEDPARAM], ["use pthread_attr_setstacksize"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_GETSCHEDPOLICY, [$HAVE_PTHREAD_ATTR_GETSCHEDPOLICY], ["use pthread_attr_setscope"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_GETSCOPE, [$HAVE_PTHREAD_ATTR_GETSCOPE], ["use pthread_attr_getscope"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE, [$HAVE_PTHREAD_ATTR_GETSTACKSIZE], ["use pthread_attr_setinheritsched"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_SETINHERITSCHED, [$HAVE_PTHREAD_ATTR_SETINHERITSCHED], ["use pthread_attr_getinheritsched"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCHEDPARAM, [$HAVE_PTHREAD_ATTR_SETSCHEDPARAM], ["use pthread_attr_setschedpolicy"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCHEDPOLICY, [$HAVE_PTHREAD_ATTR_SETSCHEDPOLICY], ["use pthread_attr_getschedpolicy"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCOPE, [$HAVE_PTHREAD_ATTR_SETSCOPE], ["use pthread_attr_setschedparam"])
+AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE, [$HAVE_PTHREAD_ATTR_SETSTACKSIZE], ["use pthread_attr_getschedparam"])
+AC_DEFINE(HAVE_SCHED_GET_PRIORITY_MAX, [$HAVE_SCHED_GET_PRIORITY_MAX], ["use sched_get_priority_max"])
+AC_DEFINE(HAVE_SCHED_GET_PRIORITY_MIN, [$HAVE_SCHED_GET_PRIORITY_MIN], ["use sched_get_priority_max"])
 
 AC_CHECK_LIB(dl,main)
@@ -1223,4 +1236,5 @@
   AC_LANG_RESTORE
 fi
+AM_CONDITIONAL(COND_MPI, [test X$HAVE_MPI = Xyes])
 
 if test X$HAVE_MPI != Xyes -a $ALWAYS_USE_MPI = yes; then
@@ -1243,4 +1257,5 @@
     AC_DEFINE(HAVE_ARMCI, 1, ["use ARMCI"])
   fi
+AM_CONDITIONAL(COND_ARMCI, [test X$HAVE_ARMCI = Xyes])
 
 if test $DEFAULT_PARALLEL = mtmpi -a X$HAVE_MPI != Xyes; then
@@ -1259,5 +1274,4 @@
 AC_SUBST(HAVE_ARMCI)
 AC_SUBST(HAVE_MPIIO)
-AC_SUBST(HAVE_PTHREAD)
 AC_SUBST(EXTRADEFINES)
 
@@ -1288,6 +1302,5 @@
 AC_LINK_IFELSE([AC_LANG_PROGRAM([
   #include <iostream>
-  #include <math.h>
-  int main(int,char**) { isnan(1.0); return 0; }
+  #include <math.h>],[isnan(1.0); return 0;
   ])],
   AC_DEFINE(HAVE_ISNAN,1, ["isnan available"])
@@ -1447,4 +1460,5 @@
   AC_SUBST(HAVE_SYSV_IPC)
 fi
+AM_CONDITIONAL(COND_SYSV_IPC, [test "X$HAVE_SYSV_IPC" = Xyes])
 
 AC_LANG_SAVE
@@ -1557,5 +1571,5 @@
   )]
 )
-AC_SUBST(HAVE_LAPACK)
+AC_DEFINE(HAVE_LAPACK, [$HAVE_LAPACK], ["use lapack"])
 if test X$HAVE_LAPACK != Xyes; then
   echo "Could not link to the LAPACK library.  It can be obtained at"
@@ -1615,4 +1629,5 @@
 AC_LANG_CPLUSPLUS
 AC_CHECK_HEADERS(libint/libint.h,
+  HAVE_LIBINT_LIBINT_H=yes
   AC_CHECK_LIB(int,init_libint_base,
     HAVE_LIBINT=yes
@@ -1620,8 +1635,10 @@
     AC_SUBST(HAVE_LIBINT)
     LIBS="-lint $LIBS"
-    )
+    ),
+  HAVE_LIBINT_LIBINT_H=no
   )
 AC_LANG_RESTORE
-AM_CONDITIONAL([CONDLIBINT], [test x"$HAVE_LIBINT" = x"1"])
+AC_DEFINE(HAVE_LIBINT_LIBINT_H, [$HAVE_LIBINT_LIBINT_H], ["use libint.h"])
+AM_CONDITIONAL([COND_LIBINT], [test x"$HAVE_LIBINT" = x"1"])
 
 dnl ----------- libr12 library checks --------------
@@ -1630,4 +1647,5 @@
 AC_LANG_CPLUSPLUS
 AC_CHECK_HEADERS(libr12/libr12.h,
+  HAVE_LIBR12_LIBR12_H=yes
   AC_CHECK_LIB(r12,init_libr12_base,
     HAVE_LIBR12=yes
@@ -1635,8 +1653,10 @@
     AC_SUBST(HAVE_LIBR12)
     LIBS="-lr12 $LIBS"
-    )
+    ),
+  HAVE_LIBR12_LIBR12_H=no
   )
 AC_LANG_RESTORE
-AM_CONDITIONAL([CONDLIBR12], [test x"$HAVE_LIBR12" = x"1"])
+AC_DEFINE(HAVE_LIBR12_LIBR12_H, [$HAVE_LIBR12_LIBR12_H], ["use libr12.h"])
+AM_CONDITIONAL([COND_LIBR12], [test x"$HAVE_LIBR12" = x"1"])
 
 dnl ----------- libderiv library checks --------------
@@ -1645,4 +1665,5 @@
 AC_LANG_CPLUSPLUS
 AC_CHECK_HEADERS(libderiv/libderiv.h,
+  HAVE_LIBDERIV_LIBDERIV_H=yes
   AC_CHECK_LIB(deriv,init_libderiv_base,
     HAVE_LIBDERIV=yes
@@ -1650,8 +1671,10 @@
     AC_SUBST(HAVE_LIBDERIV)
     LIBS="-lderiv $LIBS"
-    )
+    ),
+  HAVE_LIBDERIV_LIBDERIV_H=no
   )
 AC_LANG_RESTORE
-AM_CONDITIONAL([CONDLIBDERIV], [test x"$HAVE_LIBDERIV" = x"1"])
+AC_DEFINE(HAVE_LIBDERIV_LIBDERIV_H, [$HAVE_LIBDERIV_LIBDERIV_H], ["use libderiv.h"])
+AM_CONDITIONAL([COND_LIBDERIV], [test x"$HAVE_LIBDERIV" = x"1"])
 
 dnl ----------- make sure we have everything for cints and mbptr12 ----------
@@ -1858,5 +1881,5 @@
   EXCLUDED_DIRS="-x LIB_CCA -x SRC_LIB_CHEMISTRY_CCA -x SRC_LIB_CHEMISTRY_QC_INTCCA $EXCLUDED_DIRS"
 fi
-AM_CONDITIONAL(CONDCCA, [test x"$have_condcca" = x"true"])
+AM_CONDITIONAL(COND_CCA, [test x"$have_condcca" = x"true"])
 
 dnl --------- Find the list of all sc libraries. ---------
Index: ThirdParty/mpqc_open/src/lib/Makefile.am
===================================================================
--- ThirdParty/mpqc_open/src/lib/Makefile.am	(revision 0035ea419537dcdf74ab59b934d0227f1cca43dc)
+++ ThirdParty/mpqc_open/src/lib/Makefile.am	(revision bbc9821982d085faaabde9fa52f49343777c131a)
@@ -1,3 +1,3 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib $(MPI_CXXFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib $(EXTRADEFINES) $(MPI_CXXFLAGS)
 AM_LDFLAGS = $(MPI_LDFLAGS)
 
@@ -16,5 +16,5 @@
 MKF77SYM= $(PERL) $(top_builddir)/bin/mkf77sym.pl
 
-if CONDCCA
+if COND_CCA
 include chemistry/cca/Makefile.am
 endif
@@ -22,11 +22,19 @@
 include chemistry/molecule/Makefile.am
 include chemistry/qc/basis/Makefile.am
-#include chemistry/qc/cints/Makefile.am
+
+if COND_LIBINT
+include chemistry/qc/cints/Makefile.am
+endif
+
 include chemistry/qc/dft/Makefile.am
-#include chemistry/qc/intcca/Makefile.am
+
+if COND_CCA
+include chemistry/qc/intcca/Makefile.am
+endif
+
 include chemistry/qc/intv3/Makefile.am
 include chemistry/qc/mbpt/Makefile.am
 
-if CONDLIBINT
+if COND_LIBINT
 include chemistry/qc/mbptr12/Makefile.am
 endif
Index: ThirdParty/mpqc_open/src/lib/chemistry/cca/Makefile.am
===================================================================
--- ThirdParty/mpqc_open/src/lib/chemistry/cca/Makefile.am	(revision 0035ea419537dcdf74ab59b934d0227f1cca43dc)
+++ ThirdParty/mpqc_open/src/lib/chemistry/cca/Makefile.am	(revision bbc9821982d085faaabde9fa52f49343777c131a)
@@ -48,4 +48,7 @@
 libSCcca_la_includedir = $(includedir)/chemistry/cca
 libSCcca_la_CPPFLAGS = $(AM_CPPFLAGS)
+if COND_LIBINT
+libSCcca_la_CPPFLAGS += -DHAVE_CINTS
+endif
 libSCcca_la_LDFLAGS = $(AM_LDFLAGS)
 libSCcca_la_LIBADD =
Index: ThirdParty/mpqc_open/src/lib/chemistry/qc/cints/Makefile.am
===================================================================
--- ThirdParty/mpqc_open/src/lib/chemistry/qc/cints/Makefile.am	(revision 0035ea419537dcdf74ab59b934d0227f1cca43dc)
+++ ThirdParty/mpqc_open/src/lib/chemistry/qc/cints/Makefile.am	(revision bbc9821982d085faaabde9fa52f49343777c131a)
@@ -100,4 +100,13 @@
         $(CINTSLIBS)
 
+if COND_LIBINT
+cintstest_LDADD += -lint
+endif
+if COND_LIBR12
+cintstest_LDADD += -lr12
+endif
+if COND_LIBDERIV
+cintstest_LDADD += -lderiv
+endif
 
 EXTRA_DIST += ./chemistry/qc/cints/cintstest.in
Index: ThirdParty/mpqc_open/src/lib/chemistry/qc/intcca/Makefile.am
===================================================================
--- ThirdParty/mpqc_open/src/lib/chemistry/qc/intcca/Makefile.am	(revision 0035ea419537dcdf74ab59b934d0227f1cca43dc)
+++ ThirdParty/mpqc_open/src/lib/chemistry/qc/intcca/Makefile.am	(revision bbc9821982d085faaabde9fa52f49343777c131a)
@@ -23,7 +23,15 @@
 noinst_LTLIBRARIES += libSCintcca.la
 libSCintcca_la_includedir = $(includedir)/chemistry/qc/intcca
-libSCintcca_la_CPPFLAGS = $(AM_CPPFLAGS)
-libSCintcca_la_LDFLAGS = $(AM_LDFLAGS)
-libSCintcca_la_LIBADD =
+libSCintcca_la_CPPFLAGS = $(AM_CPPFLAGS) 
+if COND_LIBINT
+libSCintcca_la_CPPFLAGS += -DHAVE_CINTS
+endif
+libSCintcca_la_CPPFLAGS += -DDMALLOC -I../../cca
+libSCintcca_la_LDFLAGS = \
+	$(AM_LDFLAGS) \
+	-L$(CCAFE_LIB) -R$(CCAFE_LIB) \
+	-L$(BABEL_LIB) -R$(BABEL_LIB) \
+	-L$(CCA_CHEM_LIB) -R$(CCA_CHEM_LIB)
+libSCintcca_la_LIBADD = -lccafeCore -lsidl -lccachem_cxx_client -lccachem_cxx_server
 
 nobase_libSCintcca_la_include_HEADERS = ${LIBSCINTCCAHEADERS}
Index: ThirdParty/mpqc_open/src/lib/util/group/Makefile.am
===================================================================
--- ThirdParty/mpqc_open/src/lib/util/group/Makefile.am	(revision 0035ea419537dcdf74ab59b934d0227f1cca43dc)
+++ ThirdParty/mpqc_open/src/lib/util/group/Makefile.am	(revision bbc9821982d085faaabde9fa52f49343777c131a)
@@ -1,19 +1,14 @@
 LIBSCGROUPSOURCES = \
-	util/group/globcnt.cc \
 	util/group/hcube.cc \
 	util/group/memamsg.cc \
 	util/group/memiter.cc \
 	util/group/memmsg.cc \
-	util/group/memmtmpi.cc \
 	util/group/memory.cc \
 	util/group/memproc.cc \
 	util/group/memrdma.cc \
-	util/group/memshm.cc \
 	util/group/message.cc \
 	util/group/messimpl.cc \
 	util/group/messint.cc \
-	util/group/messmpi.cc \
 	util/group/messproc.cc \
-	util/group/messshm.cc \
 	util/group/mstate.cc \
 	util/group/pool.cc \
@@ -21,14 +16,13 @@
 	util/group/reduce.cc \
 	util/group/rnglock.cc \
-	util/group/thpthd.cc \
 	util/group/thread.cc \
 	util/group/topology.cc
-
+	
 #	util/group/file.cc \
 #	util/group/fileproc.cc \
-#	util/group/memarmci.cc \
 #	util/group/thpuma.cc \
 #
 TESTSOURCES = \
+	util/group/mstate.cc \
 	util/group/message.cc \
 	util/group/messimpl.cc \
@@ -50,25 +44,18 @@
 
 LIBSCGROUPHEADERS = \
-	util/group/globcnt.h \
 	util/group/hcube.h \
-	util/group/LIBS.h \
 	util/group/linkage.h \
 	util/group/memamsg.h \
 	util/group/memiter.h \
 	util/group/memmsg.h \
-	util/group/memmtmpi.h \
 	util/group/memory.h \
 	util/group/memproc.h \
 	util/group/memrdma.h \
-	util/group/memshm.h \
 	util/group/message.h \
 	util/group/messaget.h \
-	util/group/messmpi.h \
-	util/group/messshm.h \
 	util/group/mstate.h \
 	util/group/pool.h \
 	util/group/pregtime.h \
 	util/group/rnglock.h \
-	util/group/thpthd.h \
 	util/group/thread.h \
 	util/group/topology.h
@@ -76,8 +63,8 @@
 #	util/group/file.h \
 #	util/group/fileproc.h \
-#	util/group/memarmci.h \
 #	util/group/thpuma.h \
 #
 TESTHEADERS = \
+	util/group/mstate.h \
 	util/group/message.h \
 	util/group/topology.h \
@@ -94,4 +81,38 @@
 	util/group/memrdma.h
 
+if COND_SYSV_IPC
+LIBSCGROUPSOURCES += \
+	util/group/globcnt.cc \
+	util/group/memshm.cc \
+	util/group/messshm.cc
+LIBSCGROUPHEADERS += \
+	util/group/globcnt.h \
+	util/group/memshm.h \
+	util/group/messshm.h
+endif
+
+if COND_MPI
+LIBSCGROUPSOURCES += \
+	util/group/memmtmpi.cc \
+	util/group/messmpi.cc
+LIBSCGROUPHEADERS += \
+	util/group/memmtmpi.h \
+	util/group/messmpi.h
+endif
+
+if COND_ARMCI
+LIBSCGROUPSOURCES += \
+	util/group/memarmci.cc
+LIBSCGROUPHEADERS += \
+	util/group/memarmci.h
+endif
+
+if COND_PTHREAD
+LIBSCGROUPSOURCES += \
+	util/group/thpthd.cc
+LIBSCGROUPHEADERS += \
+	util/group/thpthd.h
+endif
+
 lib_LTLIBRARIES +=
 noinst_LTLIBRARIES += libSCgroup.la
