This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Fortran search path for intrinsic includes and modules


Hi!

Fortran by default doesn't use any search paths for
INCLUDE and USE lookups.  With -fopenmp,
INCLUDE 'omp_lib.h'
as well as
USE OMP_LIB
should work automatically and I think we shouldn't harass users
to provide -I options all the time.  I believe there were discussions
about the need for other intrinsic modules.

Would something like this be acceptable?

For GOMP would need some corresponding changes to install the needed
files (omp_lib.f90 omp_lib.h omp_lib.mod omp_lib_kinds.mod)
to /usr/lib/gcc/*/*/finclude/ (though not sure how to do that in
automake).

Or should we have both GFC_INCLUDE_DIR and FORTRAN_SYSTEM_INCLUDE_DIR
(say /usr/finclude or something else)?

2005-11-18  Jakub Jelinek  <jakub@redhat.com>

	* Make-lang.in (fortran/f95-lang.o): Pass -DGFC_INCLUDE_DIR.
	* f95-lang.c (gfc_init): Append GFC_INCLUDE_DIR to search
	path.

--- gcc/fortran/Make-lang.in.jj	2005-11-10 18:23:53.000000000 +0100
+++ gcc/fortran/Make-lang.in	2005-11-18 18:29:05.000000000 +0100
@@ -92,6 +92,11 @@ gfortranspec.o: $(srcdir)/fortran/gfortr
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
 
+fortran/f95-lang.o: $(srcdir)/fortran/f95-lang.c
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
+		 -DGFC_INCLUDE_DIR=\"$(libsubdir)/finclude\" \
+		 $< $(OUTPUT_OPTION)
+
 # Create the compiler driver gfortran.
 GFORTRAN_D_OBJS = gcc.o gfortranspec.o version.o prefix.o intl.o
 gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
--- gcc/fortran/f95-lang.c.jj	2005-11-07 22:27:15.000000000 +0100
+++ gcc/fortran/f95-lang.c	2005-11-18 18:27:18.000000000 +0100
@@ -316,6 +316,10 @@ gfc_init (void)
   linemap_add (&line_table, LC_RENAME, false, "<built-in>", 0);
 #endif
 
+#ifdef GFC_INCLUDE_DIR
+  gfc_add_include_path (GFC_INCLUDE_DIR);
+#endif
+
   /* First initialize the backend.  */
   gfc_init_decl_processing ();
   gfc_static_ctors = NULL_TREE;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]