Thank you very much for the advice. After this change, the program could be built (gcc 4.8.5). The compilation took about 3 hours wall time using a single processor. All tests passed.
May I have a suggestion? In PSI 3.4, there were four options in the configure script:
--with-max-am-eri maximum AM in ERIs
--with-max-am-deriv1 maximum AM in ERI first derivatives
--with-max-am-deriv2 maximum AM in ERI second derivatives
--with-max-am-r12 maximum AM in R12 integrals
Those allowed the user to use large basis sets only in an energy calculation and offered more flexibility in building the program. Please consider including those options to PSI4.