http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49138
Summary: Add /usr/include/fortran/{,gcc-<version>} to the file/module search path Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org There is a serious lack of a default-searched location for Fortran include files - and in particular for Fortran .mod files. The latter is particularly important as different compilers/different versions have different .mod files. Currently, Linux distributions usually either do not ship .mod files or they ship them simply in /usr/include. The /usr/{local/,}include/fortran/ directory should be used (and searched) for Fortran INCLUDE / #include files. Module files (or arch-dependent include files) should be searched for in an compiler/architecture-dependent subdirectory, which can be queried with -print-mod-dir-suffix: gfortran $(FFLAGS) -print-mod-dir-suffix (Note: -m... flags in the $(FFLAGS) might change the result.) Thus, the search order is: LOCAL_INCLUDE_DIR/fortran/$(gfortran -print-mod-dir-suffix) # .mod files LOCAL_INCLUDE_DIR/fortran # include files LOCAL_INCLUDE_DIR # For backward compatibility followed by the same order for SYSTEM_INCLUDE_DIR and then STANDARD_INCLUDE_DIR The result of -print-mod-dir-suffix should be gcc-<module_version>/lib{,<qual>} The reason for "lib{,<qual>}" is to allow for architecture-defined directories; using directly the target (e.g. x86_64-unknown-linux-gnu) instead of the lib won't work as for x86_64 one can have -m32 and -m64 but target remains the same, while for i686 and x86_64 -m32, the target changes but the produced binaries are the same. Additionally, for PowerPC, the default can be 32 or 64 bit. For the FHS standard tacking, see: http://bugs.linux-foundation.org/show_bug.cgi?id=757 (The proposal was discussed with Jakub, Richard and Matthias.)