When using the lahey fortran compiler the flag -M is used as the path to modules, but its also the path to where new modules should be written. So if you are referencing modules in a read-only directory using the -M flag will cause your program to fail. I think that the solution is to test for -I first (that's also the most common result, so it would make sense to test first I think) --- fortran.m4 (revision 327) +++ fortran.m4 (working copy) @@ -618,7 +618,7 @@ [cd .. ac_fc_module_flag_FCFLAGS_save=$FCFLAGS # Flag ordering is significant for gfortran and Sun. - for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do + for ac_flag in -I '-mod ' -I '-I ' '-M ' -p '-module ' '-Am -I'; do # Add the flag twice to prevent matching an output flag. FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir ${ac_flag}conftest.dir" AC_COMPILE_IFELSE([[ _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf