Subject: proposal: USE_FORTRAN
To: None <tech-pkg@netbsd.org>
From: None <mcmahill@mtl.mit.edu>
List: tech-pkg
Date: 11/17/1999 11:39:39
Problem:
  - The in tree fortran compiler (/usr/bin/f77) is buggy (see PR's 8574
    and 8663 for details).

  - Several of our packages use fortran and contain logic local to the
    package Makefile which adds the dependency on f2c for systems
    (pre-1.4) which don't ship f77.

Proposal:

  I'd like to create a variable 'USE_FORTRAN' in bsd.pkg.mk which would be
  set in the package Makefile for those packages which use fortran.  That
  way the logic pertaining to the fortran compiler, possible dependency on
  f2c, and selection of the fortran compiler are done in 1 central
  location.

  The modification to bsd.pkg.mk would be the addition of:
  
.if defined(USE_FORTRAN)
.if !exists(/usr/bin/f77) || defined(USE_F2C)
DEPENDS+=	f2c-19989812:${PKGSRCDIR}/lang/f2c
FC=		f2c-f77
.else
FC=		f77
.endif
F77=		${FC}
.endif


  This way on pre-1.4 systems (which don't have f77) the f2c dependency is
  automatically picked up.  Also, users can force the use of f2c as the
  fortran compiler by setting USE_F2C in mk.conf.  


  I will need to update bsd.pkg.mk, mk.conf.examples, Packages.txt and
  packages(7) to reflect this (and the packages which need fortran).


  The remaining question I have is if we should make f2c be the default
  for now since f77 is buggy.  Long term, the goal should be to not ship a
  buggy compiler.  I could perhaps implement f2c being the default by
  something like:

  USE_F2C?=	YES
  .if defined(USE_F2C)
  .if ${USE_F2C}=="NO"
  .undef USE_F2C
  .endif
  .endif

  Then users could put USE_F2C=NO in mk.conf to override the f2c default.


I will collect comments and suggestions before implementing this and doing
the final testing on my system.

Thanks

-Dan