From owner-freebsd-ports@FreeBSD.ORG Sat Oct 27 17:16:06 2007 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F6A616A41A for ; Sat, 27 Oct 2007 17:16:06 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from cauchy.math.missouri.edu (cauchy.math.missouri.edu [128.206.184.213]) by mx1.freebsd.org (Postfix) with ESMTP id E3E9613C481 for ; Sat, 27 Oct 2007 17:16:05 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from laptop2.gateway.2wire.net (cauchy.math.missouri.edu [128.206.184.213]) by cauchy.math.missouri.edu (8.14.1/8.13.4) with ESMTP id l9RGf8a6001964; Sat, 27 Oct 2007 11:41:08 -0500 (CDT) (envelope-from stephen@math.missouri.edu) Message-ID: <47236A23.9020901@math.missouri.edu> Date: Sat, 27 Oct 2007 11:41:07 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.8) Gecko/20071025 SeaMonkey/1.1.5 MIME-Version: 1.0 To: Harald Servat References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-ports@freebsd.org Subject: Re: fortran compiler issues in port X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Oct 2007 17:16:06 -0000 Harald Servat wrote: > Hello, > > I'm a maintainer of a port which needs a fortran compiler. Due to the > inclusion of GCC 4.2 as the default compiler for FreeBSD 7.0 I'm facing a > problem with the port. My FreeBSD 6.2 box can compile fine my port using > f77, however the build farms do not compile successfully the port because > they use gfortran42 (which comes with GCC 4.2) and this compiler needs an > special flag to compile the port. > > I was thinking to place an "if" statement checking if ${F77} is f77 or > gfortran42 and act in consequence like the code below: > > .if "${F77}" = "f77" > specific setting for F77 > .elif "${F77}" = "gfortran42" > specific setting for gfortran42 > .endif > > However, there's an issue here, what will happen when gfortran43 is > installed? It won't work. Is there a clear way to check for "gfortran*" > instead of an specific version? > As all gfortran compilers have the same specific needs for my port, I > think this should be a better and clearer way to solve the compiling problem > of my port. One possibility is to put "USE_FORTRAN" in your makefile. Then if you are using FreeBSD 6.2, I think it will first install the gcc42 port, and then use that. But to specifically answer your question, maybe something like .elif "${F77:C/[[:digit:]]*//} = "gfortran" would work. I admit I haven't tested it, but if it doesn't work something similar will. You need to read "man make" (quite an easy document to read) and "man re_format" (quite a lot to take in, and not so easy to read).