@@ -17,15 +17,24 @@ NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-netlib
1717# http://stackoverflow.com/questions/4029274/mingw-and-make-variables
1818# - Default value is 'cc' which is not always a valid command (e.g. MinGW).
1919ifeq ($(origin CC),default)
20+
21+ # Check if $(CC) refers to a valid command and set the value to gcc if not
22+ ifneq ($(findstring cmd.exe,$(SHELL)),)
23+ ifeq ($(shell where $(CC) 2>NUL),)
2024CC = gcc
21- # Change the default compile to clang on Mac OSX.
22- # http://stackoverflow.com/questions/714100/os-detecting-makefile
23- UNAME_S := $(shell uname -s)
24- ifeq ($(UNAME_S),Darwin)
25- CC = clang
26- # EXTRALIB += -Wl,-no_compact_unwind
27- endif
2825endif
26+ else # POSIX-ish
27+ ifeq ($(shell command -v $(CC) 2>/dev/null),)
28+ ifeq ($(shell uname -s),Darwin)
29+ CC = clang
30+ # EXTRALIB += -Wl,-no_compact_unwind
31+ else
32+ CC = gcc
33+ endif # Darwin
34+ endif # CC exists
35+ endif # Shell is sane
36+
37+ endif # CC is set to default
2938
3039# Default Fortran compiler (FC) is selected by f_check.
3140
@@ -230,7 +239,7 @@ endif
230239MD5SUM = md5 -r
231240endif
232241
233- ifeq ($( OSNAME), FreeBSD)
242+ ifneq (,$(findstring $( OSNAME), FreeBSD OpenBSD DragonFly) )
234243MD5SUM = md5 -r
235244endif
236245
0 commit comments