[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 02-ac-lang-program-fortran-77.patch

From: Akim Demaille
Subject: Re: 02-ac-lang-program-fortran-77.patch
Date: 08 Nov 2000 14:13:37 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Please, keep this public.

--- Begin Message --- Subject: Re: 02-ac-lang-program-fortran-77.patch Date: Tue, 07 Nov 2000 23:43:43 -0600
Akim Demaille wrote:
> from  Akim Demaille  <address@hidden>
>         * aclang.m4 (AC_LANG_PROGRAM(Fortran 77): Complain about $1 having
>         a value.
>         (_AC_LANG_COMPILER_GNU): Pass the test as the body of
>         AC_LANG_PROGRAM, not the prologue.

I am not sure what this ends up accomplishing.  This change:

>    choke me
>  #endif
>  ]])],

_still_ passes C code into the Fortran code (only this time it's between
the Fortran program statement and the end statement).  When this macro
run for AC_LANG_PROGRAM(Fortran 77), it still puts C pre-processing
into a `conftest.f' source file which is then compiled by F77!

$ cat conftest.f:
      program main
#ifndef __GNUC__
  choke me
$ g77 conftest.f
conftest.f:2: undefined or invalid # directive
      choke me
Non-numeric character at (^) in label field [info -f g77 M LEX]
conftest.f:4: undefined or invalid # directive

so it fails.  Therefore, g77 is NOT a GNU compiler!

Now do this:

$ mv conftest.f conftest.F
$ g77 conftest.F

It works!  It is a GNU compiler.  Other compilers, like my SGI
and ABSOFT will fail on this.  This is because g77, like other,
compilers use the file extension to determine if the C pre-processor
is to be run on the source before compiling.

>From 'info g77' section: Options Controlling the Kind of Output

>    For any given input file, the file name suffix determines what kind
> of program is contained in the file--that is, the language in which the
> program is written is generally indicated by the suffix.  Suffixes
> specific to GNU Fortran are listed below.  *Note gcc: (Using and
> Porting GNU CC)Overall Options, for information on suffixes recognized
> by GNU CC.
> `FILE.f'
> `FILE.for'
>      Fortran source code that should not be preprocessed.
>      Such source code cannot contain any preprocessor directives, such
>      as `#include', `#define', `#if', and so on.
>      You can force `.f' files to be preprocessed by `cpp' by using `-x
>      f77-cpp-input'.  *Note LEX::.
> `FILE.F'
> `FILE.fpp'
>      Fortran source code that must be preprocessed (by the C
>      preprocessor `cpp', which is part of GNU CC).
>      Note that preprocessing is not extended to the contents of files
>      included by the `INCLUDE' directive--the `#include' preprocessor
>      directive must be used instead.

I don't think this patch really accomplishes much.  I reiterate that the
easiest and most effective fix is to replace the _AC_LANG_COMILER_GNU
macro with the AC_PROG_F77_GNU macro from autoconf 2.14.

I don't know Marge.  Trying is the first step to failure.
                                          -- Homer

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]