[Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)

vapier at gentoo dot org gcc-bugzilla@gcc.gnu.org
Fri Sep 28 23:12:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

--- Comment #6 from Mike Frysinger <vapier at gentoo dot org> 2012-09-28 23:12:08 UTC ---
(In reply to comment #5)

that's half the equation.  the other half is the build system support.

in gcc/Makefile.in, they do:
  CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@

but you can't do that in gcc/fortran/Make-lang.in.  you can't use
$(TARGET_SYSTEM_ROOT_DEFINE) either because the variable is only AC_SUBST().

so you could add this line to gcc/Makefile.in:
  CFLAGS-fortran/cpp.o += @TARGET_SYSTEM_ROOT_DEFINE@
and it'd work.  this seems to be how they propagate the define into the
CFLAGS-c-family/c-opts.o variable, so maybe this is OK.

alternatively, gcc/Makefile.in does setup $(COMPILER_DEFINES), so adding this
to gcc/fortran/Make-lang.in works:
  CFLAGS-fortran/cpp.o += $(DRIVER_DEFINES)
but i'm sure that's the wrong answer.

the other alternative is to declare a "static const char *sysroot" inside of
gcc/fortran/gfortranspec.c and then initialize gfc_cpp_option.sysroot via that.
 this works because gfortranspec.c is compiled already with
$(COMPILER_DEFINES).

i'm wait out of my depth, so i don't know what the "right" answer is :).



More information about the Gcc-bugs mailing list