diff --git a/cint/reflex/src/Class.cxx b/cint/reflex/src/Class.cxx
index 185404fc7a8a69618e90ea8a06bb6e5654a05fa3..fc682215079d0d9b1d5de496fb441726fdbc98d7 100644
--- a/cint/reflex/src/Class.cxx
+++ b/cint/reflex/src/Class.cxx
@@ -30,6 +30,19 @@
 #if defined(__linux) || defined(__APPLE__)
 # include <cxxabi.h>
 #endif
+#if defined(__APPLE__)
+# include <AvailabilityMacros.h>
+#endif
+
+#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_7)
+namespace __cxxabiv1 {
+extern "C" void*
+__dynamic_cast(const void* __src_ptr, // Starting object.
+               const __class_type_info* __src_type, // Static type of object.
+               const __class_type_info* __dst_type, // Desired target type.
+               ptrdiff_t __src2dst); // How src and dst are related.
+}
+#endif
 
 
 //-------------------------------------------------------------------------------
@@ -95,6 +108,7 @@ Reflex::Class::CastObject(const Type& to,
       // use the internal dynamic casting of the compiler (e.g. libstdc++.so)
       void* obj3 = 0;
 #if defined(__linux) || defined(__APPLE__)
+
       obj3 = abi::__dynamic_cast(obj.Address(),
                                  (const abi::__class_type_info*) &this->TypeInfo(),
                                  (const abi::__class_type_info*) &to.TypeInfo(),
diff --git a/tmva/Makefile.arch b/tmva/Makefile.arch
index f882d40f438fd643426f1285839e6d6a6db14b8e..92529ca51a2bcf147b1e02c3bbe87bcc16717e96 100644
--- a/tmva/Makefile.arch
+++ b/tmva/Makefile.arch
@@ -434,28 +434,13 @@ LDFLAGS       = -O2 -bind_at_load
 # The SOFLAGS will be used to create the .dylib,
 # the .so will be created separately
 DllSuf        = dylib
-ifeq ($(MACOSX_MINOR),6)
+ifeq ($(subst $(MACOSX_MINOR),,12),12)
 UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.6 c++
-else
-ifeq ($(MACOSX_MINOR),5)
-UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.5 c++
-else
-ifeq ($(MACOSX_MINOR),4)
-UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.4 c++
-else
-ifeq ($(MACOSX_MINOR),3)
-UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.3 c++
+LD            = MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) c++
 else
 UNDEFOPT      = suppress
 LD            = c++
 endif
-endif
-endif
-endif
 SOFLAGS       = -dynamiclib -single_module -undefined $(UNDEFOPT)
 endif
 
@@ -468,23 +453,13 @@ LDFLAGS       = -O2 -bind_at_load
 # The SOFLAGS will be used to create the .dylib,
 # the .so will be created separately
 DllSuf        = dylib
-ifeq ($(MACOSX_MINOR),5)
+ifeq ($(subst $(MACOSX_MINOR),,12),12)
 UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.5 c++
-else
-ifeq ($(MACOSX_MINOR),4)
-UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.4 c++
-else
-ifeq ($(MACOSX_MINOR),3)
-UNDEFOPT      = dynamic_lookup
-LD            = MACOSX_DEPLOYMENT_TARGET=10.3 c++
+LD            = MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) c++
 else
 UNDEFOPT      = suppress
 LD            = c++
 endif
-endif
-endif
 SOFLAGS       = -dynamiclib -single_module -undefined $(UNDEFOPT)
 endif
 
@@ -497,7 +472,8 @@ LDFLAGS       = -m64 -O2 -bind_at_load
 # The SOFLAGS will be used to create the .dylib,
 # the .so will be created separately
 DllSuf        = dylib
-LD            = MACOSX_DEPLOYMENT_TARGET=10.4 c++
+ifeq ($(subst $(MACOSX_MINOR),,12),12)
+LD            = MACOSX_DEPLOYMENT_TARGET=10.$(MACOSX_MINOR) c++
 SOFLAGS       = -m64 -dynamiclib -single_module -undefined dynamic_lookup
 endif