ports/131114: [PATCH] bsd.gcc.mk: avoid compiler miscegenation with USE_FORTRAN
bf
bf2006a at yahoo.com
Thu Jan 29 10:50:03 UTC 2009
>Number: 131114
>Category: ports
>Synopsis: [PATCH] bsd.gcc.mk: avoid compiler miscegenation with USE_FORTRAN
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Jan 29 10:50:03 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: bf
>Release: 8-CURRENT i386
>Organization:
-
>Environment:
>Description:
1) To avoid subtle compatibility problems that may occur with the mixing of different compilers, use C and C++ compilers or compiler front-ends from the same compiler suite as the Fortran compiler when USE_FORTRAN is defined, whenever possible;
2) Output an error message when an unexpected value is given for USE_FORTRAN;
3) Fix the OSVERSION for which lang/gcc34 should be used when USE_FORTRAN=g77 :
http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/freebsd-versions.html#AEN6173
states that gcc 4.2.x wasn't imported into the base system until 700042;
4) Add RUN_DEPENDS to the output of the test-gcc target.
Questions: Should lang/icc be used when USE_FORTRAN=ifort? Should USE_GCC and
USE_FORTRAN also fix the objective-C compiler, in case one is used?
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
--- bsd.gcc.mk.orig 2009-01-17 22:10:19.000000000 -0500
+++ bsd.gcc.mk 2009-01-29 03:54:27.768139384 -0500
@@ -23,6 +23,7 @@
# USE_FORTRAN= g77 # use g77-34 (lang/gcc34; FreeBSD>=7)
# # or system f77 (/usr/bin/f77; FreeBSD<=6)
# USE_FORTRAN= ifort # use the Intel compiler (lang/ifc)
+# USE_FORTRAN= gfortran44 # use gfortran44 (lang/gcc44)
#
# Due to object file incompatiblity between Fortran compilers, we strongly
# recommend to use only one of them on any system.
@@ -61,8 +62,9 @@
#
#
-# bsd.gcc.mk can also be used only for FC, F77 settings; in this case we
-# do not define USE_GCC.
+# When possible, Fortran, C and C++ compilers (or compiler front-ends)
+# from the same compiler suite are used to ensure compatibility; so
+# USE_FORTRAN may override USE_GCC.
#
.if defined (USE_FORTRAN)
@@ -72,28 +74,47 @@
RUN_DEPENDS+= gfortran43:${PORTSDIR}/lang/gcc43
FC:= gfortran43
F77:= gfortran43
-. endif
+CC:= gcc43
+CXX:= g++43
+. undef USE_GCC
+
+# gfortran44 from lang/gcc44
+. elif ${USE_FORTRAN} == gfortran44
+BUILD_DEPENDS+= gfortran44:${PORTSDIR}/lang/gcc44
+RUN_DEPENDS+= gfortran44:${PORTSDIR}/lang/gcc44
+FC:= gfortran44
+F77:= gfortran44
+CC:= gcc44
+CXX:= g++44
+. undef USE_GCC
# Intel Fortran compiler from lang/ifc.
-. if ${USE_FORTRAN} == ifort
+. elif ${USE_FORTRAN} == ifort
BUILD_DEPENDS+= ${LOCALBASE}/intel_fc_80/bin/ifort:${PORTSDIR}/lang/ifc
RUN_DEPENDS+= ${LOCALBASE}/intel_fc_80/bin/ifort:${PORTSDIR}/lang/ifc
FC:= ${LOCALBASE}/intel_fc_80/bin/ifort
F77:= ${LOCALBASE}/intel_fc_80/bin/ifort
-. endif
# In some case we want to use g77 from lang/gcc34 (FreeBSD>=7) or f77
# (FreeBSD<=6).
-. if ${USE_FORTRAN} == g77
-. if (${OSVERSION} > 700000)
+. elif ${USE_FORTRAN} == g77
+. if (${OSVERSION} >= 700042)
BUILD_DEPENDS+= g77-34:${PORTSDIR}/lang/gcc34
RUN_DEPENDS+= g77-34:${PORTSDIR}/lang/gcc34
FC:= g77-34
F77:= g77-34
-.else
+CC:= gcc34
+CXX:= g++34
+. else
F77:= f77
FC:= f77
+CC:= cc
+CXX:= c++
. endif
+. undef USE_GCC
+
+. else
+IGNORE= Unknown value of USE_FORTRAN specified (USE_FORTRAN=${USE_FORTRAN})
. endif
CONFIGURE_ENV+= F77="${F77}" FC="${FC}" FFLAGS="${FFLAGS}"
@@ -223,3 +244,4 @@
@echo CC=${CC} - CXX=${CXX} - CFLAGS=${CFLAGS}
@echo F77=${F77} - FC=${FC} - FFLAGS=${FFLAGS}
@echo BUILD_DEPENDS=${BUILD_DEPENDS}
+ @echo RUN_DEPENDS=${RUN_DEPENDS}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list