From c06fdeae0b3b4d627aacef2bda9df0acd079626b Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Mon, 26 Sep 2016 02:13:52 +0200
Subject: [PATCH] Add macOS Sierra support and don't support anymore anything
 <10.9.

---
 cint/ROOT/cintdlls.mk        |   2 +-
 config/Makefile.macosx       | 103 +++++++++++--------------------------------
 config/Makefile.macosx64     |  88 ++++++++----------------------------
 config/Makefile.macosxicc    |  28 ++++++------
 etc/Makefile.arch            |  20 ---------
 math/genvector/test/Makefile |   9 ----
 math/smatrix/test/Makefile   |   9 ----
 net/http/civetweb/civetweb.c |   6 ++-
 test/Makefile                |  42 ------------------
 tmva/Makefile.arch           |  47 +++-----------------
 10 files changed, 69 insertions(+), 285 deletions(-)

diff --git a/cint/ROOT/cintdlls.mk b/cint/ROOT/cintdlls.mk
index fb3a6d9..bf7f34d 100644
--- a/cint/ROOT/cintdlls.mk
+++ b/cint/ROOT/cintdlls.mk
@@ -214,7 +214,7 @@ $(CINTDLLDIRDLLSTL)/G__cpp_complex.cxx: $(CINTDLLDIRL)/dll_stl/cmplx.h $(CINTCPP
 	   -V -c-1 -A -Z0 $(CINTDLLDIRL)/dll_stl/cmplx.h
 	touch $@
 
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
+ifeq ($(PLATFORM),macosx)
 # MACOSX_MINOR > 4
 $(CINTDLLDIRL)/G__c_posix.c: MACOSX_UNIX03 = -D__DARWIN_UNIX03
 endif
diff --git a/config/Makefile.macosx b/config/Makefile.macosx
index 1ecf47b..9675962 100644
--- a/config/Makefile.macosx
+++ b/config/Makefile.macosx
@@ -20,22 +20,7 @@ endif
 # MacOS X version
 MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
 MACOSX_CPU   := $(shell uname -p)
-FINK_DIR     := $(shell which fink 2>&1 | sed -ne "s/\/bin\/fink//p")
-
-# Compiler:
-# From "Apple clang version ... (based on LLVM 3.0svn)"
-# i.e. OSX 10.7 we will take clang as default
-APPLE_CLANG  := $(shell clang -v 2>&1 | sed -n "s/.*based on LLVM //p" | cut -d . -f 1)
-ifeq ($(APPLE_CLANG),)
-# if OSX > 9 always use clang
-ifeq ($(subst $(MACOSX_MINOR),,123456789),123456789)
-APPLE_CLANG  := 3
-else
-APPLE_CLANG  := 1
-endif
-endif
 
-ifeq ($(subst $(APPLE_CLANG),,12),12)
 CXX           = clang++
 CC            = clang
 ifeq ($(CXX11),yes)
@@ -44,47 +29,46 @@ endif
 ifeq ($(CXX14),yes)
 CXX11FLAGS    = -std=c++1y
 endif
+ifeq ($(LIBCXX),yes)
+CXX11FLAGS   += -stdlib=libc++
+CXX11LDFLAGS  = -stdlib=libc++
 else
-CXX           = g++
-CC            = gcc
+CXX11FLAGS   += -stdlib=libstdc++
+CXX11LDFLAGS  = -stdlib=libstdc++
 endif
+
 CXXFLAGS      = -m32 -pipe -Wshadow -W -Wall -Woverloaded-virtual \
-                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) $(FINK_CXXFLAGS) \
+                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) \
                 $(TARGETFLAGS) $(CXX11FLAGS) $(USERCONF_CXXFLAGS)
 CFLAGS        = -m32 -pipe -Wshadow -W -Wall -fsigned-char -fno-common \
-                $(EXTRA_CFLAGS) $(FINK_CFLAGS) $(TARGETFLAGS) $(USERCONF_CFLAGS)
+                $(EXTRA_CFLAGS) $(TARGETFLAGS) $(USERCONF_CFLAGS)
 CINTCXXFLAGS  = -m32 -pipe -W -Wall -Woverloaded-virtual \
-                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) $(FINK_CXXFLAGS) \
+                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) \
                 -DG__REGEXP -DG__UNIX -DG__SHAREDLIB \
                 -DG__ROOT -DG__REDIRECTIO -DG__OSFDLL \
                 -DG__STD_EXCEPTION $(TARGETFLAGS) $(CXX11FLAGS) $(USERCONF_CXXFLAGS)
 CINTCFLAGS    = -m32 -pipe -W -Wall -fsigned-char -fno-common \
-                $(EXTRA_CFLAGS) $(FINK_CFLAGS) \
+                $(EXTRA_CFLAGS) \
                 -DG__REGEXP -DG__UNIX -DG__SHAREDLIB \
                 -DG__ROOT -DG__REDIRECTIO -DG__OSFDLL \
                 -DG__STD_EXCEPTION $(TARGETFLAGS) $(USERCONF_CFLAGS)
 COMPILER      = gnu
 
 # Linker:
-ifeq ($(subst $(APPLE_CLANG),,12),12)
 LD            = clang++
-else
-LD            = g++
-endif
 LDFLAGS       = $(OPT) -m32 -mmacosx-version-min=$(MACOSXVERS)
+F77LDFLAGS   := $(LDFLAGS)
+LDFLAGS      += $(CXX11LDFLAGS)
 LDFLAGS      += $(EXTRA_LDFLAGS)
 
-FORCELINK     = yes
-NEEDFINK      = yes
+FORCELINK     = no
 
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
-# this is set for 64 but not for 32  bit
+# needed for 10.12, won't harm for earlier
 CXXFLAGS     += -D__DARWIN_UNIX03=1
 CFLAGS       += -D__DARWIN_UNIX03=1
 CINTCXXFLAGS += -D__DARWIN_UNIX03=1
 CINTCFLAGS   += -D__DARWIN_UNIX03=1
-endif
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
+
 ifeq ($(USECONFIG),FALSE)
 SOFLAGS       = -dynamiclib -single_module -Wl,-dead_strip_dylibs \
                 -install_name @rpath/
@@ -92,45 +76,13 @@ else
 SOFLAGS       = -dynamiclib -single_module -Wl,-dead_strip_dylibs \
                 -install_name $(LIBDIR)/
 endif
-FORCELINK     = no
-NEEDFINK      = no
-else
-ifeq ($(subst $(MACOSX_MINOR),,123),123)
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined dynamic_lookup -install_name $(LIBDIR)/
-FORCELINK     = no
-NEEDFINK      = no
-else
-ifeq ($(MACOSX_MINOR),3)
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined dynamic_lookup -install_name $(LIBDIR)/
-LDFLAGS      += -bind_at_load
-CXXFLAGS     += -Wno-long-double
-CFLAGS       += -Wno-long-double
-CINTCXXFLAGS += -Wno-long-double
-CINTCFLAGS   += -Wno-long-double
-else
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined suppress -install_name $(LIBDIR)/
-LDFLAGS      += -bind_at_load
-CXXFLAGS     += -Wno-long-double
-CFLAGS       += -Wno-long-double
-CINTCXXFLAGS += -Wno-long-double
-CINTCFLAGS   += -Wno-long-double
-endif
-endif
-endif
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 SOEXT         = so
-else
-SOEXT         = dylib
-endif
 
 # System libraries:
-SYSLIBS       = -lm $(FINK_LDFLAGS) $(OSTHREADLIBDIR) \
+SYSLIBS       = -lm $(OSTHREADLIBDIR) \
                 $(OSTHREADLIB) -ldl $(ALLOCLIBDIR) $(ALLOCLIB)
 XLIBS         = $(XPMLIBDIR) $(XPMLIB) $(X11LIBDIR) -lXext -lX11
-CILIBS        = -lm $(FINK_LDFLAGS) -ldl
+CILIBS        = -lm -ldl
 
 # Fortran:
 F77ORG        = gfortran
@@ -146,19 +98,6 @@ INSTALL      := /bin/cp -pPR
 INSTALLDATA  := /bin/cp -pPR
 
 # Extras
-ifeq ($(NEEDFINK),yes)
-FINK_CXXFLAGS := $(shell [ -d $(FINK_DIR)/include ] && echo -I$(FINK_DIR)/include)
-FINK_CFLAGS   := $(shell [ -d $(FINK_DIR)/include ] && echo -I$(FINK_DIR)/include)
-FINK_LDFLAGS  := $(shell [ -d $(FINK_DIR)/lib ] && echo -L$(FINK_DIR)/lib)
-endif
-
-ifeq ($(MACOSX_MINOR),7)
-MACOSX_SSL_DEPRECATED = yes
-endif
-ifeq ($(MACOSX_MINOR),8)
-MACOSX_SSL_DEPRECATED = yes
-MACOSX_ODBC_DEPRECATED = yes
-endif
 ifeq ($(MACOSX_MINOR),9)
 MACOSX_SSL_DEPRECATED = yes
 MACOSX_ODBC_DEPRECATED = yes
@@ -182,6 +121,14 @@ MACOSX_KRB5_DEPRECATED = yes
 MACOSX_TMPNAM_DEPRECATED = yes
 MACOSX_LDAP_DEPRECATED = yes
 endif
+ifeq ($(MACOSX_MINOR),12)
+MACOSX_SSL_DEPRECATED = yes
+MACOSX_ODBC_DEPRECATED = yes
+MACOSX_GLU_DEPRECATED = yes
+MACOSX_KRB5_DEPRECATED = yes
+MACOSX_TMPNAM_DEPRECATED = yes
+MACOSX_LDAP_DEPRECATED = yes
+endif
 
 ifeq ($(CONFIGURE),yes)
 showcxx:
diff --git a/config/Makefile.macosx64 b/config/Makefile.macosx64
index 65e2363..5a42920 100644
--- a/config/Makefile.macosx64
+++ b/config/Makefile.macosx64
@@ -20,22 +20,7 @@ endif
 # OS version
 MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
 MACOSX_CPU   := $(shell uname -p)
-FINK_DIR     := $(shell which fink 2>&1 | sed -ne "s/\/bin\/fink//p")
-
-# Compiler:
-# From "Apple clang version ... (based on LLVM 3.0svn)"
-# i.e. OSX 10.7 we will take clang as default
-APPLE_CLANG  := $(shell clang -v 2>&1 | sed -n "s/.*based on LLVM //p" | cut -d . -f 1)
-ifeq ($(APPLE_CLANG),)
-# if OSX > 9 always use clang
-ifeq ($(subst $(MACOSX_MINOR),,123456789),123456789)
-APPLE_CLANG  := 3
-else
-APPLE_CLANG  := 1
-endif
-endif
 
-ifeq ($(subst $(APPLE_CLANG),,12),12)
 CXX           = clang++
 CC            = clang
 ifeq ($(CXX11),yes)
@@ -51,22 +36,20 @@ else
 CXX11FLAGS   += -stdlib=libstdc++
 CXX11LDFLAGS  = -stdlib=libstdc++
 endif
-else
-CXX           = g++
-CC            = gcc
-endif
+
 CXXFLAGS      = -m64 -pipe -Wshadow -W -Wall -Woverloaded-virtual \
-                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) $(FINK_CXXFLAGS) \
+                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) \
                 $(TARGETFLAGS) $(CXX11FLAGS) $(USERCONF_CXXFLAGS)
 CFLAGS        = -m64 -pipe -Wshadow -W -Wall -fsigned-char -fno-common \
-                $(EXTRA_CFLAGS) $(FINK_CFLAGS) $(TARGETFLAGS) $(USERCONF_CFLAGS)
+                $(EXTRA_CFLAGS) $(TARGETFLAGS) $(USERCONF_CFLAGS)
 CINTCXXFLAGS  = -m64 -pipe -W -Wall -Woverloaded-virtual \
-                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) $(FINK_CXXFLAGS) \
+                -fsigned-char -fno-common $(EXTRA_CXXFLAGS) \
                 -DG__REGEXP -DG__UNIX -DG__SHAREDLIB \
                 -DG__ROOT -DG__REDIRECTIO -DG__OSFDLL \
-                -DG__STD_EXCEPTION $(TARGETFLAGS) $(CXX11FLAGS) $(USERCONF_CXXFLAGS)
+                -DG__STD_EXCEPTION $(TARGETFLAGS) $(CXX11FLAGS) \
+                $(USERCONF_CXXFLAGS)
 CINTCFLAGS    = -m64 -pipe -W -Wall -fsigned-char -fno-common \
-                $(EXTRA_CFLAGS) $(FINK_CFLAGS) \
+                $(EXTRA_CFLAGS) \
                 -DG__REGEXP -DG__UNIX -DG__SHAREDLIB \
                 -DG__ROOT -DG__REDIRECTIO -DG__OSFDLL \
                 -DG__STD_EXCEPTION $(TARGETFLAGS) $(USERCONF_CFLAGS)
@@ -78,20 +61,14 @@ NOOPT        += -pedantic -Wno-long-long
 endif
 
 # Linker:
-ifeq ($(subst $(APPLE_CLANG),,12),12)
 LD            = clang++
-else
-LD            = g++
-endif
 LDFLAGS       = $(OPT) -m64 -mmacosx-version-min=$(MACOSXVERS)
 F77LDFLAGS   := $(LDFLAGS)
 LDFLAGS      += $(CXX11LDFLAGS)
 LDFLAGS      += $(EXTRA_LDFLAGS)
 
-FORCELINK     = yes
-NEEDFINK      = yes
+FORCELINK     = no
 
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 ifeq ($(USECONFIG),FALSE)
 SOFLAGS       = -dynamiclib -single_module -Wl,-dead_strip_dylibs \
                 -install_name @rpath/
@@ -99,37 +76,13 @@ else
 SOFLAGS       = -dynamiclib -single_module -Wl,-dead_strip_dylibs \
                 -install_name $(LIBDIR)/
 endif
-FORCELINK     = no
-NEEDFINK      = no
-else
-ifeq ($(subst $(MACOSX_MINOR),,123),123)
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined dynamic_lookup -install_name $(LIBDIR)/
-FORCELINK     = no
-NEEDFINK      = no
-else
-ifeq ($(MACOSX_MINOR),3)
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined dynamic_lookup -install_name $(LIBDIR)/
-LDFLAGS      += -bind_at_load
-else
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined suppress -install_name $(LIBDIR)/
-LDFLAGS      += -bind_at_load
-endif
-endif
-endif
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 SOEXT         = so
-else
-SOEXT         = dylib
-endif
 
 # System libraries:
-SYSLIBS       = -lm $(FINK_LDFLAGS) $(OSTHREADLIBDIR) \
+SYSLIBS       = -lm $(OSTHREADLIBDIR) \
                 $(OSTHREADLIB) -ldl $(ALLOCLIBDIR) $(ALLOCLIB)
 XLIBS         = $(XPMLIBDIR) $(XPMLIB) $(X11LIBDIR) -lXext -lX11
-CILIBS        = -lm $(FINK_LDFLAGS) -ldl
+CILIBS        = -lm -ldl
 
 # Fortran:
 F77ORG        = gfortran
@@ -145,19 +98,6 @@ INSTALL      := /bin/cp -pPR
 INSTALLDATA  := /bin/cp -pPR
 
 # Extras
-ifeq ($(NEEDFINK),yes)
-FINK_CXXFLAGS := $(shell [ -d $(FINK_DIR)/include ] && echo -I$(FINK_DIR)/include)
-FINK_CFLAGS   := $(shell [ -d $(FINK_DIR)/include ] && echo -I$(FINK_DIR)/include)
-FINK_LDFLAGS  := $(shell [ -d $(FINK_DIR)/lib ] && echo -L$(FINK_DIR)/lib)
-endif
-
-ifeq ($(MACOSX_MINOR),7)
-MACOSX_SSL_DEPRECATED = yes
-endif
-ifeq ($(MACOSX_MINOR),8)
-MACOSX_SSL_DEPRECATED = yes
-MACOSX_ODBC_DEPRECATED = yes
-endif
 ifeq ($(MACOSX_MINOR),9)
 MACOSX_SSL_DEPRECATED = yes
 MACOSX_ODBC_DEPRECATED = yes
@@ -181,6 +121,14 @@ MACOSX_KRB5_DEPRECATED = yes
 MACOSX_TMPNAM_DEPRECATED = yes
 MACOSX_LDAP_DEPRECATED = yes
 endif
+ifeq ($(MACOSX_MINOR),12)
+MACOSX_SSL_DEPRECATED = yes
+MACOSX_ODBC_DEPRECATED = yes
+MACOSX_GLU_DEPRECATED = yes
+MACOSX_KRB5_DEPRECATED = yes
+MACOSX_TMPNAM_DEPRECATED = yes
+MACOSX_LDAP_DEPRECATED = yes
+endif
 
 ifeq ($(CONFIGURE),yes)
 showcxx:
diff --git a/config/Makefile.macosxicc b/config/Makefile.macosxicc
index 835f9d3..4b7d77e 100644
--- a/config/Makefile.macosxicc
+++ b/config/Makefile.macosxicc
@@ -80,7 +80,6 @@ LDFLAGS      += $(EXTRA_LDFLAGS)
 
 FORCELINK     = no
 
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 ifeq ($(USECONFIG),FALSE)
 SOFLAGS       = -dynamiclib -single_module -Wl,-dead_strip_dylibs \
                 -install_name @rpath/
@@ -88,17 +87,7 @@ else
 SOFLAGS       = -dynamiclib -single_module -Wl,-dead_strip_dylibs \
                 -install_name $(LIBDIR)/
 endif
-else
-ifeq ($(subst $(MACOSX_MINOR),,123),123)
-SOFLAGS       = -dynamiclib -single_module \
-                -undefined dynamic_lookup -install_name $(LIBDIR)/
-endif
-endif
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 SOEXT         = so
-else
-SOEXT         = dylib
-endif
 
 # System libraries:
 SYSLIBS       = -lm $(OSTHREADLIBDIR) \
@@ -139,21 +128,30 @@ INSTALL      := /bin/cp -pPR
 INSTALLDATA  := /bin/cp -pPR
 
 # Extras
-ifeq ($(MACOSX_MINOR),7)
+ifeq ($(MACOSX_MINOR),9)
 MACOSX_SSL_DEPRECATED = yes
+MACOSX_ODBC_DEPRECATED = yes
+MACOSX_GLU_DEPRECATED = yes
+MACOSX_KRB5_DEPRECATED = yes
+MACOSX_TMPNAM_DEPRECATED = yes
 endif
-ifeq ($(MACOSX_MINOR),8)
+ifeq ($(MACOSX_MINOR),10)
 MACOSX_SSL_DEPRECATED = yes
 MACOSX_ODBC_DEPRECATED = yes
+MACOSX_GLU_DEPRECATED = yes
+MACOSX_KRB5_DEPRECATED = yes
+MACOSX_TMPNAM_DEPRECATED = yes
+MACOSX_LDAP_DEPRECATED = yes
 endif
-ifeq ($(MACOSX_MINOR),9)
+ifeq ($(MACOSX_MINOR),11)
 MACOSX_SSL_DEPRECATED = yes
 MACOSX_ODBC_DEPRECATED = yes
 MACOSX_GLU_DEPRECATED = yes
 MACOSX_KRB5_DEPRECATED = yes
 MACOSX_TMPNAM_DEPRECATED = yes
+MACOSX_LDAP_DEPRECATED = yes
 endif
-ifeq ($(MACOSX_MINOR),10)
+ifeq ($(MACOSX_MINOR),12)
 MACOSX_SSL_DEPRECATED = yes
 MACOSX_ODBC_DEPRECATED = yes
 MACOSX_GLU_DEPRECATED = yes
diff --git a/etc/Makefile.arch b/etc/Makefile.arch
index 04c598e..4f989fa 100644
--- a/etc/Makefile.arch
+++ b/etc/Makefile.arch
@@ -370,16 +370,8 @@ CXXFLAGS      = $(OPT2) -pipe -Wall -W -Woverloaded-virtual
 LD            = g++
 LDFLAGS       = $(OPT2) -mmacosx-version-min=$(MACOSXTARGET)
 EXPLLINKLIBS  = $(ROOTLIBS) $(ROOTGLIBS)
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 DllSuf        = so
-else
-DllSuf        = dylib
-endif
-ifneq ($(subst $(MACOSX_MINOR),,12),12)
 LD            = g++
-endif
 SOFLAGS       = -dynamiclib -single_module -install_name $(CURDIR)/
 endif
 
@@ -393,13 +385,7 @@ CXXFLAGS      = $(OPT) -fPIC -wd1476
 LD            = icpc
 LDFLAGS       = $(OPT2) -mmacosx-version-min=$(MACOSXTARGET)
 EXPLLINKLIBS  = $(ROOTLIBS) $(ROOTGLIBS)
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 DllSuf        = so
-else
-DllSuf        = dylib
-endif
 SOFLAGS       = -dynamiclib -single_module -install_name $(CURDIR)/
 endif
 
@@ -411,13 +397,7 @@ CXXFLAGS      = $(OPT2) -pipe -Wall -W -Woverloaded-virtual
 LD            = g++
 LDFLAGS       = $(OPT2) -mmacosx-version-min=$(MACOSXTARGET)
 EXPLLINKLIBS  = $(ROOTLIBS) $(ROOTGLIBS)
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-ifeq ($(subst $(MACOSX_MINOR),,1234),1234)
 DllSuf        = so
-else
-DllSuf        = dylib
-endif
 SOFLAGS       = -dynamiclib -single_module -install_name $(CURDIR)/
 endif
 
diff --git a/math/genvector/test/Makefile b/math/genvector/test/Makefile
index 7f6dbea..fdc22a2 100644
--- a/math/genvector/test/Makefile
+++ b/math/genvector/test/Makefile
@@ -182,16 +182,7 @@ ifeq ($(ARCH),aix5)
 		/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt) $@ $(GLIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS) $^ $(OutPutOpt) $@
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-else
-		$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
-	 	   $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 ifeq ($(PLATFORM),win32)
 		bindexplib libTrackDict.$(DllSuf) $^ > libTrackDict.def
diff --git a/math/smatrix/test/Makefile b/math/smatrix/test/Makefile
index 2f5c57a..2ae435d 100644
--- a/math/smatrix/test/Makefile
+++ b/math/smatrix/test/Makefile
@@ -138,16 +138,7 @@ ifeq ($(ARCH),aix5)
 		/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS) $^ $(OutPutOpt) $@
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-else
-		$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
-	 	   $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 		$(LD) $(SOFLAGS) $(LDFLAGS) $^  $(LIBS) $(OutPutOpt)$@
 		$(MT_DLL) 
diff --git a/test/Makefile b/test/Makefile
index 3659e81..2a8f14e 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -337,13 +337,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 ifeq ($(PLATFORM),win32)
 		bindexplib $* $^ > $*.def
@@ -364,13 +358,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 ifeq ($(PLATFORM),win32)
 		bindexplib $* $^ > $*.def
@@ -479,13 +467,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(LIBS) $(STRESSMATHLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(LIBS) $(STRESSMATHLIBS) $(OutPutOpt)$@
 		$(MT_DLL)
@@ -671,13 +653,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(EXPLLINKLIBS) $(OutPutOpt)$@
 		$(MT_DLL)
@@ -690,13 +666,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(EXPLLINKLIBS) $(OutPutOpt)$@
 		$(MT_DLL)
@@ -709,13 +679,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(GLIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(EXPLLINKLIBS) $(OutPutOpt)$@
 		$(MT_DLL)
@@ -727,13 +691,7 @@ ifeq ($(ARCH),aix5)
 		$(MAKESHARED) $(OutPutOpt) $@ $(LIBS) -p 0 $^
 else
 ifeq ($(PLATFORM),macosx)
-# We need to make both the .dylib and the .so
 		$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
-ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
-ifeq ($(MACOSX_MINOR),4)
-		ln -sf $@ $(subst .$(DllSuf),.so,$@)
-endif
-endif
 else
 		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(EXPLLINKLIBS) $(OutPutOpt)$@
 		$(MT_DLL)
diff --git a/tmva/Makefile.arch b/tmva/Makefile.arch
index 1eb90d2..a925c58 100644
--- a/tmva/Makefile.arch
+++ b/tmva/Makefile.arch
@@ -440,17 +440,9 @@ MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
 CXX           = c++
 CXXFLAGS      = -O2 -pipe -Wall -W -Woverloaded-virtual -Wshadow
 LDFLAGS       = -O2 -bind_at_load
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-DllSuf        = dylib
-ifeq ($(subst $(MACOSX_MINOR),,12),12)
-UNDEFOPT      = dynamic_lookup
+DllSuf        = so
 LD            = MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) c++
-else
-UNDEFOPT      = suppress
-LD            = c++
-endif
-SOFLAGS       = -dynamiclib -single_module -undefined $(UNDEFOPT)
+SOFLAGS       = -dynamiclib -single_module -undefined dynamic_lookup
 endif
 
 ifeq ($(ARCH),macosxicc)
@@ -459,17 +451,9 @@ MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
 CXX           = c++
 CXXFLAGS      = -O2 -pipe -Wall -W -Woverloaded-virtual -Wshadow
 LDFLAGS       = -O2 -bind_at_load
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-DllSuf        = dylib
-ifeq ($(subst $(MACOSX_MINOR),,12),12)
-UNDEFOPT      = dynamic_lookup
+DllSuf        = so
 LD            = MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) c++
-else
-UNDEFOPT      = suppress
-LD            = c++
-endif
-SOFLAGS       = -dynamiclib -single_module -undefined $(UNDEFOPT)
+SOFLAGS       = -dynamiclib -single_module -undefined dynamic_lookup
 endif
 
 ifeq ($(ARCH),macosx64)
@@ -478,14 +462,10 @@ MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
 CXX           = c++
 CXXFLAGS      = -m64 -O2 -pipe -Wall -W -Woverloaded-virtual -Wshadow
 LDFLAGS       = -m64 -O2 -bind_at_load
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-DllSuf        = dylib
-ifeq ($(subst $(MACOSX_MINOR),,12),12)
+DllSuf        = so
 LD            = MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) c++
 SOFLAGS       = -m64 -dynamiclib -single_module -undefined dynamic_lookup
 endif
-endif
 
 ifeq ($(ARCH),macosxxlc)
 # MacOS X with IBM xlC compiler
@@ -493,22 +473,9 @@ MACOSX_MINOR := $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2)
 CXX           = xlC
 CXXFLAGS      = -O
 LDFLAGS       = -O -Wl,-bind_at_load
-# The SOFLAGS will be used to create the .dylib,
-# the .so will be created separately
-DllSuf        = dylib
-ifeq ($(MACOSX_MINOR),4)
-UNDEFOPT      = dynamic_lookup
+DllSuf        = so
 LD            = MACOSX_DEPLOYMENT_TARGET=10.4 xlC
-else
-ifeq ($(MACOSX_MINOR),3)
-UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.3 xlC
-else
-UNDEFOPT      = suppress
-LD            = xlC
-endif
-endif
-SOFLAGS       = -qmkshrobj -single_module -undefined $(UNDEFOPT)
+SOFLAGS       = -qmkshrobj -single_module -undefined dynamic_lookup
 endif
 
 ifeq ($(ARCH),win32)
-- 
2.7.4

