I took a look at this issue this evening.
I wonder if the easiest thing to do is actually to avoid the two-stage scons here, and just run everything through a single scons sconsUtils build. To make that work, I eliminated the separate liblapackstub library, and just rolled Nate's LAPACK wrapper into psfex itself. I think this makes the build overall simpler and more reliable, and also fixes the problem reported in this issue. While I was at it, I questioned whether we really want the bin/psfex executable, and discovered that nothing broke if I didn't bother building it.
...but I don't feel that I can review this, since I made many of the changes. Robert Lupton, Paul Price & Nate Lust, you have some prior expertise here – do you have any comments? My changes are on u/swinbank/DM-3749 in psfex.
More precisely, if $SCONSFLAGS (which scons obeys) includes flags added by sconsUtils.