2.7 Module Search Path

This section describes the default module search path and how this might be changed. By default the compiler will search the current directory, local include dir, prefix include dir, gcc version specific modules and lastly native system header dir. The exact location and whether all these directories are used depends upon the configuration options used when building GCC.

The ‘-I’ option option can be used to introduce new directories in the module search path and for convenience the options ‘-flibs=’ and ‘-fm2-pathname-root=’ are also provided.

The site wide modules are typically located at prefix/include/m2 whereas the version specific modules are located in libsubdir/m2. Both of these /m2 directories are organized such that the non dialect specific modules are at the top and dialect specific modules are in subdirectories.

The ‘-fm2-pathname-root=’ option is equivalent to adding a ‘-I’ path for every library dialect. For example if the library dialect order is selected by ‘-flibs=pim,iso,log’ and ‘-fm2-pathname-root=foo’ is supplied then this is equivalent to the following pairs of options:

-fm2-pathname=m2pim -Ifoo/m2/m2pim
-fm2-pathname=m2iso -Ifoo/m2/m2iso
-fm2-pathname=m2log -Ifoo/m2/m2log
-fm2-pathname=- -Ifoo/m2

The option ‘-fsources’ will show the source module, path and pathname for each module parsed.