diff --git a/Makefile b/Makefile index 392b1d25c..428262782 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ endif shared : ifndef NO_SHARED -ifeq ($(OSNAME), Linux) +ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS)) @$(MAKE) -C exports so @-ln -fs $(LIBSONAME) $(LIBPREFIX).so @-ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION) diff --git a/Makefile.install b/Makefile.install index 66ec3f8bc..5da4e68c9 100644 --- a/Makefile.install +++ b/Makefile.install @@ -29,7 +29,7 @@ install : lib.grd #for inc @echo \#ifndef OPENBLAS_CONFIG_H > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h @echo \#define OPENBLAS_CONFIG_H >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h - @awk 'NF {print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h + @$(AWK) 'NF {print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h @echo \#define OPENBLAS_VERSION \" OpenBLAS $(VERSION) \" >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h @cat openblas_config_template.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h @echo \#endif \/\* OPENBLAS_CONFIG_H \*\/ >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h @@ -64,7 +64,7 @@ endif #for install shared library ifndef NO_SHARED @echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) -ifeq ($(OSNAME), Linux) +ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS)) @install -pm755 $(LIBSONAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) @cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \ ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \ diff --git a/Makefile.system b/Makefile.system index b3e83e2dd..1e9fcb161 100644 --- a/Makefile.system +++ b/Makefile.system @@ -967,7 +967,7 @@ ifndef MD5SUM MD5SUM = md5sum endif -AWK = awk +AWK = nawk REVISION = -r$(VERSION) MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION))) diff --git a/driver/others/blas_server.c b/driver/others/blas_server.c index e1c644a80..c3bf80173 100644 --- a/driver/others/blas_server.c +++ b/driver/others/blas_server.c @@ -70,7 +70,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*********************************************************************/ #include "common.h" -#if defined(OS_LINUX) || defined(OS_NETBSD) || defined(OS_DARWIN) || defined(OS_ANDROID) +#if defined(OS_LINUX) || defined(OS_NETBSD) || defined(OS_DARWIN) || defined(OS_ANDROID) || defined(OS_SUNOS) #include #include #include @@ -576,10 +576,12 @@ int blas_thread_init(void){ struct rlimit rlim; const char *msg = strerror(ret); fprintf(STDERR, "OpenBLAS blas_thread_init: pthread_create: %s\n", msg); +#ifdef RLIMIT_NPROC if(0 == getrlimit(RLIMIT_NPROC, &rlim)) { fprintf(STDERR, "OpenBLAS blas_thread_init: RLIMIT_NPROC " "%ld current, %ld max\n", (long)(rlim.rlim_cur), (long)(rlim.rlim_max)); } +#endif if(0 != raise(SIGINT)) { fprintf(STDERR, "OpenBLAS blas_thread_init: calling exit(3)\n"); exit(EXIT_FAILURE); diff --git a/driver/others/memory.c b/driver/others/memory.c index af7bd81ce..a52032877 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -144,7 +144,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if defined(_MSC_VER) && !defined(__clang__) #define CONSTRUCTOR __cdecl #define DESTRUCTOR __cdecl -#elif defined(OS_DARWIN) && defined(C_GCC) +#elif (defined(OS_DARWIN) || defined(OS_SUNOS)) && defined(C_GCC) #define CONSTRUCTOR __attribute__ ((constructor)) #define DESTRUCTOR __attribute__ ((destructor)) #else @@ -169,7 +169,7 @@ void goto_set_num_threads(int num_threads) {}; #else -#ifdef OS_LINUX +#if defined(OS_LINUX) || defined(OS_SUNOS) #ifndef NO_AFFINITY int get_num_procs(void); #else diff --git a/exports/Makefile b/exports/Makefile index 46d858e14..1595c5eae 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -114,7 +114,7 @@ endif dllinit.$(SUFFIX) : dllinit.c $(CC) $(CFLAGS) -c -o $(@F) -s $< -ifeq ($(OSNAME), Linux) +ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS)) so : ../$(LIBSONAME) diff --git a/f_check b/f_check index e7e46886f..4c9d81e9f 100644 --- a/f_check +++ b/f_check @@ -1,5 +1,7 @@ #!/usr/bin/perl +$hostos = `uname -s | sed -e s/\-.*//`; chop($hostos); + # # 1. Not specified # 1.1 Automatically detect, then check compiler @@ -272,8 +274,9 @@ if ($link ne "") { } if ($flags =~ /^\-Y/) { + next if ($hostos eq 'SunOS'); $linker_L .= "-Wl,". $flags . " "; - } + } if ($flags =~ /^\-rpath\@/) { $flags =~ s/\@/\,/g; diff --git a/getarch.c b/getarch.c index 272b123cd..fb80a4c9b 100644 --- a/getarch.c +++ b/getarch.c @@ -86,7 +86,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #endif -#ifdef linux +#if defined(linux) || defined(__sun__) #include #include #endif @@ -906,7 +906,7 @@ static int get_num_cores(void) { size_t len; #endif -#ifdef linux +#if defined(linux) || defined(__sun__) //returns the number of processors which are currently online return sysconf(_SC_NPROCESSORS_ONLN);