This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

Re: getarg_ and iargc_


On Fri, Mar 17, 2006 at 12:13:30AM +0100, Steven Bosscher wrote:
> Hi,
> 
> So this Mandriva guy tells me gfortran can't compile Scilab, and
> he is right!  Scilab is a pretty important piece of Fortran that
> many people use, so it is a shame that gfortran can't build it
> right now.  But the reason why it can't is not really a Fortran
> problem (at least I haven't found any yet ;-) but a compatibility
> problem with the library wrt. what g77 had (libU77?)...
> 
> Scilab uses some kind of C <-> Fortran compatiblity layer where
> they have a getarg.c that calls C2F(getarg), with a line in one
> of the included header files that says "#define C2F(name) name##_".
> The same thing happens with iargc, so the gerarg.o object that
> the linker sees ends up calling getarg_ and iargc_.
> 
> This worked Just Fine with g77, and apparently it works with g95
> as well.  It does not work with gfortran, because we have instead
> gfortran_getarg_i4 and so on.
> 
> I'm looking for suggestions for how to fix this in libgfortran.
> I would fix this in Scilab, except that if gfortran is to be a
> drop-in replacement for g77, then we shouldn't have this kind of
> rather silly compatibilty issues.

It is nothing new. I had to do the same for netcdf.


H.J.
--- netcdf/configure.in.gfortran	2004-12-18 08:32:32.000000000 -0800
+++ netcdf/configure.in	2006-02-05 20:13:56.000000000 -0800
@@ -135,6 +135,16 @@ case "${FC+set}" in
 				;;
 			esac
 			;;
+		     dnl Gfortran in gcc 4.x needs -DgFortran.
+		     gfortran*)
+			case "${CPPFLAGS}" in
+			     *-DgFortran*)
+				;;
+			     *)
+				CPPFLAGS="${CPPFLAGS} -DgFortran"
+				;;
+			esac
+			;;
 		     *)	
 			case "$ac_cv_fc_compiler_gnu" in
 			     yes) 
--- netcdf/fortran/cfortran.h.gfortran	2004-10-14 15:07:59.000000000 -0700
+++ netcdf/fortran/cfortran.h	2006-02-05 20:24:49.000000000 -0800
@@ -83,7 +83,7 @@ only C calling FORTRAN subroutines will 
 
 /* VAX/VMS does not let us \-split long #if lines. */ 
 /* Split #if into 2 because some HP-UX can't handle long #if */
-#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)||defined(PATHSCALE_COMPILER))
+#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)||defined(PATHSCALE_COMPILER)||defined(gFortran))
 #if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran)||defined(AbsoftProFortran)||defined(SXFortran))
 /* If no Fortran compiler is given, we choose one for the machines we know.   */
 #if defined(lynx) || defined(VAXUltrix)
@@ -132,7 +132,7 @@ only C calling FORTRAN subroutines will 
 #endif /* ...Fortran */
 
 /* Split #if into 2 because some HP-UX can't handle long #if */
-#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)||defined(PATHSCALE_COMPILER))
+#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)||defined(PATHSCALE_COMPILER)||defined(gFortran))
 #if !(defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)||defined(CONVEXFortran)||defined(PowerStationFortran)||defined(AbsoftUNIXFortran)||defined(AbsoftProFortran)||defined(SXFortran))
 /* If your compiler barfs on ' #error', replace # with the trigraph for #     */
  #error "cfortran.h:  Can't find your environment among:\
@@ -170,7 +170,7 @@ only C calling FORTRAN subroutines will 
 
 /* Throughout cfortran.h we use: UN = Uppercase Name.  LN = Lowercase Name.   */
 
-#if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(CONVEXFortran) || defined(SXFortran) || defined(extname) || defined(PATHSCALE_COMPILER)
+#if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(CONVEXFortran) || defined(SXFortran) || defined(extname) || defined(PATHSCALE_COMPILER) || defined(gFortran)
 #define CFC_(UN,LN)            _(LN,_)      /* Lowercase FORTRAN symbols.     */
 #define orig_fcallsc(UN,LN)    CFC_(UN,LN)
 #else 


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