I think if we add

    AC_SUBST([CXXFLAGS],["${CXXFLAGS} ${OPENMP_CXXFLAGS}"])

here, we can avoid modifying all the Makefiles. At least, it seems to pass the flags correctly to both compiler and linker on my system. May you check that this works for you, too? I'd rather have one change than 120.

Also, at the beginning of this file we need to change the autoconf version check to

    AC_PREREQ(2.62)

to make sure that `AC_OPENMP` is defined.