https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79087
Bug ID: 79087 Summary: CPATH environment variable not recognised. Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: w6ws at earthlink dot net Target Milestone: --- The ENVIRONMENT portion of the gfortran man page states: The gfortran compiler currently does not make use of any environment variables to control its operation above and beyond those that affect the operation of gcc. Then referring to the ENVIRONMENT portion of the gcc man page, under CPATH, it states: CPATH specifies a list of directories to be searched as if specified with -I, but after any paths given with -I options on the command line. This environment variable is used regardless of which language is being preprocessed. Unfortunately gfortran does not seem to recognize CPATH: wws@w6ws-4:~$ cd /tmp wws@w6ws-4:/tmp$ mkdir include wws@w6ws-4:/tmp$ cat > include/inc.inc integer, parameter :: answer = 42 wws@w6ws-4:/tmp$ export CPATH=/tmp/include wws@w6ws-4:/tmp$ cat > junk.f90 program junk include "inc.inc" print *, answer end program wws@w6ws-4:/tmp$ gfortran junk.f90 junk.f90:2: Error: Can't open included file 'inc.inc' wws@w6ws-4:/tmp$ gfortran -I$CPATH junk.f90 wws@w6ws-4:/tmp$ a.out 42 wws@w6ws-4:/tmp$ /tmp$ gfortran --version GNU Fortran (GCC) 7.0.0 20160831 (experimental) Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. wws@w6ws-4:/tmp$ Intel Fortran does support this. It is handy when used in conjunction with the "module" package that is often used at sites to select various software packages. This ticket might be a duplicate of PR 65998, but that ticket seems more pre-processor (cpp) and architecture oriented.