diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 2f1a1b03342c3fd8983f23a5b677520b92a88d6b..6a91c2416154a7dc16f9f272988803db8af50939 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -18,6 +18,7 @@ set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
 
 include(CheckCXXCompilerFlag)
 include(Variables)
+include(SDL2)
 
 # Portable compilation flags.
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DADDRESS_SIZE=${ADDRESS_SIZE}")
@@ -359,5 +360,9 @@ else()
   add_definitions(-DAL_ENABLE_ALL_TIMERS=0)
 endif()
 
+if(SDL_FOUND)
+  add_definitions(-DLL_SDL=1)
+endif()
+
 
 endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake
index 58af48f1ca149c269bc45facce435676db0f57b4..8f7c8f1dd6c86c8f2fd02b2bcf3e51a9431b2ef1 100644
--- a/indra/cmake/UI.cmake
+++ b/indra/cmake/UI.cmake
@@ -24,9 +24,7 @@ if (LINUX)
 
     if(USE_X11)
       list(APPEND PKGCONFIG_PACKAGES 
-            pangoxft
             x11
-            xinerama
             )
     endif()
       
@@ -42,13 +40,11 @@ if (LINUX)
           gdk-3.0
           gtk+-3.0
           x11
-          xinerama
           )
 
       if(USE_X11)
         list(APPEND PKGCONFIG_PACKAGES 
               x11
-              xinerama
               )
       endif()
 
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt
index b344d0d11b471a1a373fd702be33bef5e8148644..f8fee2c7b2938f61e775fe782fd6035f5f593903 100644
--- a/indra/llrender/CMakeLists.txt
+++ b/indra/llrender/CMakeLists.txt
@@ -110,10 +110,6 @@ add_library (llrender ${llrender_SOURCE_FILES})
 
 set_target_properties(llrender PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
 
-if (SDL_FOUND)
-  target_compile_definitions(llrender PUBLIC LL_SDL=1)
-endif (SDL_FOUND)
-
 # Libraries on which this library depends, needed for Linux builds
 # Sort by high-level to low-level
 target_link_libraries(llrender 
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 7bdcc8e2d2be7f57a12b7c687c90beae637ea513..dd060826775b4bceacd92fa65c24e6b9e0bfd4cd 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1732,7 +1732,7 @@ void LLGLState::resetTextureStates()
 	for (S32 j = maxTextureUnits-1; j >=0; j--)
 	{
 		gGL.getTexUnit(j)->activate();
-		glClientActiveTextureARB(GL_TEXTURE0_ARB+j);
+		glClientActiveTexture(GL_TEXTURE0_ARB+j);
 		j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable();
 	}
 }
@@ -1880,7 +1880,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
 
 		if (i < gGLManager.mNumTextureUnits)
 		{
-			glClientActiveTextureARB(GL_TEXTURE0_ARB+i);
+			glClientActiveTexture(GL_TEXTURE0_ARB+i);
 			stop_glerror();
 			glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &stackDepth);
 			stop_glerror();
@@ -1965,7 +1965,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
 
 	stop_glerror();
 	gGL.getTexUnit(0)->activate();
-	glClientActiveTextureARB(GL_TEXTURE0_ARB);
+	glClientActiveTexture(GL_TEXTURE0_ARB);
 	stop_glerror();
 
 	if (error)
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 00254ca44640bf62133c836f5cc82f52f95d11cd..c330dc2661e79ce50b66eed252c0c3163dfd7a21 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -747,7 +747,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32
 				if (is_compressed)
 				{
  					S32 tex_size = dataFormatBytes(mFormatPrimary, w, h);
-					glCompressedTexImage2DARB(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
+					glCompressedTexImage2D(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
 					stop_glerror();
 				}
 				else
@@ -942,7 +942,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32
 		if (is_compressed)
 		{
 			S32 tex_size = dataFormatBytes(mFormatPrimary, w, h);
-			glCompressedTexImage2DARB(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
+			glCompressedTexImage2D(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
 			stop_glerror();
 		}
 		else
@@ -1876,7 +1876,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
 			return FALSE ;
 		}
 
-		glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));		
+		glGetCompressedTexImage(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));		
 		//stop_glerror();
 	}
 	else
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 310a561a8c1a3b88aa2484c210f2b0ced382d942..fe4acfa64def1eb6eebfa5c10f2db6fe2d53af09 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -127,7 +127,7 @@ void LLTexUnit::refreshState(void)
 
 	gGL.flush();
 	
-	glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
+	glActiveTexture(GL_TEXTURE0_ARB + mIndex);
 
 	if (mCurrTexType != TT_NONE)
 	{
@@ -148,7 +148,7 @@ void LLTexUnit::activate(void)
 	if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
 	{
 		gGL.flush();
-		glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
+		glActiveTexture(GL_TEXTURE0_ARB + mIndex);
 		gGL.mCurrTextureUnitIndex = mIndex;
 	}
 }
@@ -192,7 +192,7 @@ void LLTexUnit::bindFast(LLTexture* texture)
 {
     LLImageGL* gl_tex = texture->getGLTexture();
 
-    glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
+    glActiveTexture(GL_TEXTURE0_ARB + mIndex);
     gGL.mCurrTextureUnitIndex = mIndex;
     mCurrTexture = gl_tex->getTexName();
     if (!mCurrTexture)
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 56bf8302e14c43533d29d3295c0661799f3537ec..9c5543cbe0ed4bb53857cef30fead12cf308e3e2 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -188,12 +188,6 @@ add_library (llwindow
   ${viewer_SOURCE_FILES}
   )
 
-if (SDL_FOUND)
-  set_property(TARGET llwindow
-    PROPERTY COMPILE_DEFINITIONS LL_SDL=1
-    )
-endif (SDL_FOUND)
-
 target_link_libraries (llwindow llcommon ${llwindow_LINK_LIBRARIES} readerwriterqueue)
   
 if (DARWIN)
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 756d1741082b94fa73da63ca63a9219548abaaad..ca769f76e059c70972cad692d58a74d863f0e425 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1860,10 +1860,6 @@ add_executable(${VIEWER_BINARY_NAME}
     ${viewer_SOURCE_FILES}
     )
 
-if (SDL_FOUND)
-  target_compile_definitions(${VIEWER_BINARY_NAME} PRIVATE LL_SDL=1)
-endif (SDL_FOUND)
-
 if (USE_SENTRY)
   target_compile_definitions(${VIEWER_BINARY_NAME} PRIVATE ${SENTRY_DEFINE})
 
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 5b7a4281d890852a7c31ac5d70be8ace04d88f94..3789f7431de18e3bfe179ef90eb77894009979c5 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -38,13 +38,13 @@
 #include "llsettingssky.h"
 #include "lllegacyatmospherics.h"
 
-const F32 SKY_BOX_MULT			= 16.0f;
-const F32 HEAVENLY_BODY_DIST	= HORIZON_DIST - 20.f;
-const F32 HEAVENLY_BODY_FACTOR	= 0.1f;
-const F32 HEAVENLY_BODY_SCALE	= HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR;
+constexpr F32 SKY_BOX_MULT			= 16.0f;
+constexpr F32 HEAVENLY_BODY_DIST	= HORIZON_DIST - 20.f;
+constexpr F32 HEAVENLY_BODY_FACTOR	= 0.1f;
+constexpr F32 HEAVENLY_BODY_SCALE	= HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR;
 
-const F32 SKYTEX_COMPONENTS = 4;
-const F32 SKYTEX_RESOLUTION = 64;
+constexpr S32 SKYTEX_COMPONENTS = 4;
+constexpr S32 SKYTEX_RESOLUTION = 64;
 
 class LLEnvironment;
 class LLFace;