0001-autotools-Lazily-change-libGL-to-libOpenGL.patch (16480B)
- From 6eac68a48b8aacbc2025397df0d9f40ac8ff79a4 Mon Sep 17 00:00:00 2001
- From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
- Date: Tue, 9 Mar 2021 06:37:22 +0100
- Subject: [PATCH] autotools: Lazily change libGL to libOpenGL
- Correct way would be to check for libGL first and then try libOpenGL.
- ---
- configure | 98 +++++++++++++++++------------------
- configure.ac | 10 ++--
- dlls/winewayland.drv/opengl.c | 4 +-
- dlls/winex11.drv/opengl.c | 6 +--
- include/config.h.in | 6 +--
- 5 files changed, 62 insertions(+), 62 deletions(-)
- diff --git a/configure b/configure
- index 8648f515f7d..b4fd183e728 100755
- --- a/configure
- +++ b/configure
- @@ -7000,7 +7000,7 @@ else
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
- -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
- +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
- @@ -7046,7 +7046,7 @@ else
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
- -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
- +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
- @@ -7070,7 +7070,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
- -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
- +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
- @@ -7115,7 +7115,7 @@ else
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
- -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
- +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
- @@ -7139,7 +7139,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
- -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
- +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
- @@ -12549,13 +12549,13 @@ fi
- opengl_msg=""
- if test "x$with_opengl" != "xno"
- then
- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lGL" >&5
- -$as_echo_n "checking for -lGL... " >&6; }
- -if ${ac_cv_lib_soname_GL+:} false; then :
- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lOpenGL" >&5
- +$as_echo_n "checking for -lOpenGL... " >&6; }
- +if ${ac_cv_lib_soname_OpenGL+:} false; then :
- $as_echo_n "(cached) " >&6
- else
- ac_check_soname_save_LIBS=$LIBS
- -LIBS="-lGL $X_LIBS -lm $X_EXTRA_LIBS $LIBS"
- +LIBS="-lOpenGL $X_LIBS -lm $X_EXTRA_LIBS $LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- @@ -12576,30 +12576,30 @@ return glXCreateContext ();
- _ACEOF
- if ac_fn_c_try_link "$LINENO"; then :
- case "$LIBEXT" in
- - dll) ac_cv_lib_soname_GL=`$ac_cv_path_LDD conftest.exe | grep "GL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
- - dylib) ac_cv_lib_soname_GL=`$OTOOL -L conftest$ac_exeext | grep "libGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
- - *) ac_cv_lib_soname_GL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
- - if ${ac_cv_lib_soname_GL:+false} :; then :
- - ac_cv_lib_soname_GL=`$LDD conftest$ac_exeext | grep "libGL\\.$LIBEXT" | sed -e "s/^.*\(libGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
- + dll) ac_cv_lib_soname_OpenGL=`$ac_cv_path_LDD conftest.exe | grep "OpenGL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
- + dylib) ac_cv_lib_soname_OpenGL=`$OTOOL -L conftest$ac_exeext | grep "libOpenGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libOpenGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
- + *) ac_cv_lib_soname_OpenGL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libOpenGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libOpenGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
- + if ${ac_cv_lib_soname_OpenGL:+false} :; then :
- + ac_cv_lib_soname_OpenGL=`$LDD conftest$ac_exeext | grep "libOpenGL\\.$LIBEXT" | sed -e "s/^.*\(libOpenGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
- fi ;;
- esac
- else
- - ac_cv_lib_soname_GL=
- + ac_cv_lib_soname_OpenGL=
- fi
- rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- LIBS=$ac_check_soname_save_LIBS
- fi
- -if ${ac_cv_lib_soname_GL:+false} :; then :
- +if ${ac_cv_lib_soname_OpenGL:+false} :; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
- $as_echo "not found" >&6; }
- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lGL" >&5
- -$as_echo_n "checking for -lGL... " >&6; }
- -if ${ac_cv_lib_soname_GL+:} false; then :
- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lOpenGL" >&5
- +$as_echo_n "checking for -lOpenGL... " >&6; }
- +if ${ac_cv_lib_soname_OpenGL+:} false; then :
- $as_echo_n "(cached) " >&6
- else
- ac_check_soname_save_LIBS=$LIBS
- -LIBS="-lGL $X_LIBS -lm $X_EXTRA_LIBS -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib $LIBS"
- +LIBS="-lOpenGL $X_LIBS -lm $X_EXTRA_LIBS -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib $LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- @@ -12620,21 +12620,21 @@ return glXCreateContext ();
- _ACEOF
- if ac_fn_c_try_link "$LINENO"; then :
- case "$LIBEXT" in
- - dll) ac_cv_lib_soname_GL=`$ac_cv_path_LDD conftest.exe | grep "GL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
- - dylib) ac_cv_lib_soname_GL=`$OTOOL -L conftest$ac_exeext | grep "libGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
- - *) ac_cv_lib_soname_GL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
- - if ${ac_cv_lib_soname_GL:+false} :; then :
- - ac_cv_lib_soname_GL=`$LDD conftest$ac_exeext | grep "libGL\\.$LIBEXT" | sed -e "s/^.*\(libGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
- + dll) ac_cv_lib_soname_OpenGL=`$ac_cv_path_LDD conftest.exe | grep "OpenGL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
- + dylib) ac_cv_lib_soname_OpenGL=`$OTOOL -L conftest$ac_exeext | grep "libOpenGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libOpenGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
- + *) ac_cv_lib_soname_OpenGL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libOpenGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libOpenGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
- + if ${ac_cv_lib_soname_OpenGL:+false} :; then :
- + ac_cv_lib_soname_OpenGL=`$LDD conftest$ac_exeext | grep "libOpenGL\\.$LIBEXT" | sed -e "s/^.*\(libOpenGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
- fi ;;
- esac
- else
- - ac_cv_lib_soname_GL=
- + ac_cv_lib_soname_OpenGL=
- fi
- rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- LIBS=$ac_check_soname_save_LIBS
- fi
- -if ${ac_cv_lib_soname_GL:+false} :; then :
- +if ${ac_cv_lib_soname_OpenGL:+false} :; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
- $as_echo "not found" >&6; }
- if test -f /usr/X11R6/lib/libGL.a
- @@ -12645,24 +12645,24 @@ This probably prevents linking to OpenGL. Try deleting the file and restarting c
- opengl_msg="No OpenGL library found on this system."
- fi
- else
- - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_GL" >&5
- -$as_echo "$ac_cv_lib_soname_GL" >&6; }
- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_OpenGL" >&5
- +$as_echo "$ac_cv_lib_soname_OpenGL" >&6; }
- cat >>confdefs.h <<_ACEOF
- -#define SONAME_LIBGL "$ac_cv_lib_soname_GL"
- +#define SONAME_LIBOPENGL "$ac_cv_lib_soname_OpenGL"
- _ACEOF
- - OPENGL_LIBS="-Xlinker -dylib_file -Xlinker /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -lGL"
- + OPENGL_LIBS="-Xlinker -dylib_file -Xlinker /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -lOpenGL"
- fi
- else
- - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_GL" >&5
- -$as_echo "$ac_cv_lib_soname_GL" >&6; }
- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_OpenGL" >&5
- +$as_echo "$ac_cv_lib_soname_OpenGL" >&6; }
- cat >>confdefs.h <<_ACEOF
- -#define SONAME_LIBGL "$ac_cv_lib_soname_GL"
- +#define SONAME_LIBOPENGL "$ac_cv_lib_soname_OpenGL"
- _ACEOF
- - OPENGL_LIBS="-lGL"
- + OPENGL_LIBS="-lOpenGL"
- fi
- if test "x$with_osmesa" != "xno"
- then
- @@ -12871,13 +12871,13 @@ _ACEOF
- fi
- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lGL" >&5
- -$as_echo_n "checking for -lGL... " >&6; }
- -if ${ac_cv_lib_soname_GL+:} false; then :
- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lOpenGL" >&5
- +$as_echo_n "checking for -lOpenGL... " >&6; }
- +if ${ac_cv_lib_soname_OpenGL+:} false; then :
- $as_echo_n "(cached) " >&6
- else
- ac_check_soname_save_LIBS=$LIBS
- -LIBS="-lGL $LIBS"
- +LIBS="-lOpenGL $LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- @@ -12898,30 +12898,30 @@ return glFlush ();
- _ACEOF
- if ac_fn_c_try_link "$LINENO"; then :
- case "$LIBEXT" in
- - dll) ac_cv_lib_soname_GL=`$ac_cv_path_LDD conftest.exe | grep "GL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
- - dylib) ac_cv_lib_soname_GL=`$OTOOL -L conftest$ac_exeext | grep "libGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
- - *) ac_cv_lib_soname_GL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
- - if ${ac_cv_lib_soname_GL:+false} :; then :
- - ac_cv_lib_soname_GL=`$LDD conftest$ac_exeext | grep "libGL\\.$LIBEXT" | sed -e "s/^.*\(libGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
- + dll) ac_cv_lib_soname_OpenGL=`$ac_cv_path_LDD conftest.exe | grep "OpenGL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
- + dylib) ac_cv_lib_soname_OpenGL=`$OTOOL -L conftest$ac_exeext | grep "libOpenGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libOpenGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
- + *) ac_cv_lib_soname_OpenGL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libOpenGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libOpenGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
- + if ${ac_cv_lib_soname_OpenGL:+false} :; then :
- + ac_cv_lib_soname_OpenGL=`$LDD conftest$ac_exeext | grep "libOpenGL\\.$LIBEXT" | sed -e "s/^.*\(libOpenGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
- fi ;;
- esac
- else
- - ac_cv_lib_soname_GL=
- + ac_cv_lib_soname_OpenGL=
- fi
- rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- LIBS=$ac_check_soname_save_LIBS
- fi
- -if ${ac_cv_lib_soname_GL:+false} :; then :
- +if ${ac_cv_lib_soname_OpenGL:+false} :; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
- $as_echo "not found" >&6; }
- else
- - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_GL" >&5
- -$as_echo "$ac_cv_lib_soname_GL" >&6; }
- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_OpenGL" >&5
- +$as_echo "$ac_cv_lib_soname_OpenGL" >&6; }
- cat >>confdefs.h <<_ACEOF
- -#define SONAME_LIBGL "$ac_cv_lib_soname_GL"
- +#define SONAME_LIBOPENGL "$ac_cv_lib_soname_OpenGL"
- _ACEOF
- diff --git a/configure.ac b/configure.ac
- index 29d48b6062e..5590dd6846f 100644
- --- a/configure.ac
- +++ b/configure.ac
- @@ -1275,10 +1275,10 @@ then
- opengl_msg=""
- if test "x$with_opengl" != "xno"
- then
- - WINE_CHECK_SONAME(GL,glXCreateContext,
- - [OPENGL_LIBS="-lGL"],
- - [WINE_CHECK_SONAME(GL,glXCreateContext,
- - [OPENGL_LIBS="-Xlinker -dylib_file -Xlinker /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -lGL"],
- + WINE_CHECK_SONAME(OpenGL,glXCreateContext,
- + [OPENGL_LIBS="-lOpenGL"],
- + [WINE_CHECK_SONAME(OpenGL,glXCreateContext,
- + [OPENGL_LIBS="-Xlinker -dylib_file -Xlinker /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -lOpenGL"],
- [if test -f /usr/X11R6/lib/libGL.a
- then
- opengl_msg="/usr/X11R6/lib/libGL.a is present on your system.
- @@ -1323,7 +1323,7 @@ then
- WINE_PACKAGE_FLAGS(WAYLAND_CLIENT,[wayland-client])
- WINE_PACKAGE_FLAGS(WAYLAND_EGL,[wayland-egl])
- WINE_CHECK_SONAME(EGL,eglGetProcAddress)
- - WINE_CHECK_SONAME(GL,glFlush)
- + WINE_CHECK_SONAME(OpenGL,glFlush)
- WINE_CHECK_SONAME(GLESv2,glFlush)
- fi
- WINE_NOTICE_WITH(wayland, [test -z "$WAYLAND_CLIENT_LIBS"],
- diff --git a/dlls/winewayland.drv/opengl.c b/dlls/winewayland.drv/opengl.c
- index 0504a4ad96b..22f114edcf7 100644
- --- a/dlls/winewayland.drv/opengl.c
- +++ b/dlls/winewayland.drv/opengl.c
- @@ -1106,9 +1106,9 @@ static BOOL egl_init(void)
- ERR("failed to load %s: %s\n", SONAME_LIBEGL, dlerror());
- return FALSE;
- }
- - if (!(opengl_handle = dlopen(SONAME_LIBGL, RTLD_NOW|RTLD_GLOBAL)))
- + if (!(opengl_handle = dlopen(SONAME_LIBOPENGL, RTLD_NOW|RTLD_GLOBAL)))
- {
- - WARN("failed to load %s: %s, trying GLESv2\n", SONAME_LIBGL, dlerror());
- + WARN("failed to load %s: %s, trying GLESv2\n", SONAME_LIBOPENGL, dlerror());
- if (!(opengl_handle = dlopen(SONAME_LIBGLESV2, RTLD_NOW|RTLD_GLOBAL)))
- {
- ERR("failed to load %s: %s\n", SONAME_LIBGLESV2, dlerror());
- diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
- index c44c587bf14..4f4f60438e6 100644
- --- a/dlls/winex11.drv/opengl.c
- +++ b/dlls/winex11.drv/opengl.c
- @@ -43,7 +43,7 @@
- #include "wine/heap.h"
- #include "wine/debug.h"
- -#ifdef SONAME_LIBGL
- +#ifdef SONAME_LIBOPENGL
- WINE_DEFAULT_DEBUG_CHANNEL(wgl);
- WINE_DECLARE_DEBUG_CHANNEL(winediag);
- @@ -550,7 +550,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
- /* No need to load any other libraries as according to the ABI, libGL should be self-sufficient
- and include all dependencies */
- - opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW | RTLD_GLOBAL );
- + opengl_handle = dlopen( SONAME_LIBOPENGL, RTLD_NOW | RTLD_GLOBAL );
- if (opengl_handle == NULL)
- {
- ERR( "Failed to load libGL: %s\n", dlerror() );
- @@ -3420,4 +3420,4 @@ void destroy_gl_drawable( HWND hwnd )
- {
- }
- -#endif /* defined(SONAME_LIBGL) */
- +#endif /* defined(SONAME_LIBOPENGL) */
- diff --git a/include/config.h.in b/include/config.h.in
- index 8b2441a548b..5f45fd42cb9 100644
- --- a/include/config.h.in
- +++ b/include/config.h.in
- @@ -1247,9 +1247,6 @@
- /* Define to the soname of the libfreetype library. */
- #undef SONAME_LIBFREETYPE
- -/* Define to the soname of the libGL library. */
- -#undef SONAME_LIBGL
- -
- /* Define to the soname of the libGLESv2 library. */
- #undef SONAME_LIBGLESV2
- @@ -1286,6 +1283,9 @@
- /* Define to the soname of the libopenal library. */
- #undef SONAME_LIBOPENAL
- +/* Define to the soname of the libOpenGL library. */
- +#undef SONAME_LIBOPENGL
- +
- /* Define to the soname of the libOSMesa library. */
- #undef SONAME_LIBOSMESA
- --
- 2.26.2