Skip to content

Commit f0d5e6e

Browse files
committed
MAKE - ENHANCEMENT - Add checks for Fortran and C compiler environment variables
1 parent e0ae516 commit f0d5e6e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

install/DEFAULTS.inc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,36 @@
365365
# general defaults
366366
#-----------------------------------------------------------------
367367

368+
# Check if the user has set environment variables for the Fortran compiler and math libraries.
369+
# If not, throw an error.
370+
371+
ifndef FC
372+
$(error "Must set environment variable FC to a Fortran compiler (e.g. gfortran, ifort, pgfortran)")
373+
else ifeq ($(findstring ifort,$(FC)),ifort)
374+
$(info Using Legacy Intel Fortran compiler)
375+
else ifeq ($(findstring ifx,$(FC)),ifx)
376+
$(info Using Intel Fortran compiler)
377+
else ifeq ($(findstring gfortran,$(FC)),gfortran)
378+
$(info Using GNU Fortran compiler)
379+
else ifeq ($(findstring pgfortran,$(FC)),pgfortran)
380+
$(info Using PGI Fortran compiler)
381+
else
382+
$(error "Unsupported Fortran compiler. Must set environment variable FC to a Fortran compiler (e.g. gfortran, ifort, pgfortran)")
383+
endif
384+
ifndef CC
385+
$(error "Must set environment variable CC to a C compiler (e.g. gcc, icc, pgcc)")
386+
else ifeq ($(findstring gcc,$(CC)),gcc)
387+
$(info Using GNU C compiler)
388+
else ifeq ($(findstring icc,$(CC)),icc)
389+
$(info Using Legacy Intel C compiler)
390+
else ifeq ($(findstring icx,$(CC)),icx)
391+
$(info Using Intel C compiler)
392+
else ifeq ($(findstring pgcc,$(CC)),pgcc)
393+
$(info Using PGI C compiler)
394+
else
395+
$(error "Unsupported C compiler. Must set environment variable CC to a C compiler (e.g. gcc, icc, pgcc)")
396+
endif
397+
368398
# List of needed dependencies, will be appended if math or netcdf
369399
# libraries are not found
370400
NEEDED_DEPS = harvest

0 commit comments

Comments
 (0)