Skip to content

Commit

Permalink
glu32: No longer load the Unix libGLU.
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
  • Loading branch information
julliard committed Nov 12, 2020
1 parent 4da1bca commit ec55b1c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 164 deletions.
76 changes: 0 additions & 76 deletions configure
Expand Up @@ -855,7 +855,6 @@ with_freetype
with_gettext
with_gettextpo
with_gphoto
with_glu
with_gnutls
with_gsm
with_gssapi
Expand Down Expand Up @@ -2594,7 +2593,6 @@ Optional Packages:
--without-gettext do not use gettext
--with-gettextpo use the GetTextPO library to rebuild po files
--without-gphoto do not use gphoto (Digital Camera support)
--without-glu do not use the GLU library
--without-gnutls do not use GnuTLS (schannel support)
--without-gsm do not use libgsm (GSM 06.10 codec support)
--without-gssapi do not use GSSAPI (Kerberos SSP support)
Expand Down Expand Up @@ -3989,12 +3987,6 @@ if test "${with_gphoto+set}" = set; then :
fi


# Check whether --with-glu was given.
if test "${with_glu+set}" = set; then :
withval=$with_glu;
fi


# Check whether --with-gnutls was given.
if test "${with_gnutls+set}" = set; then :
withval=$with_gnutls;
Expand Down Expand Up @@ -12563,74 +12555,6 @@ _ACEOF

OPENGL_LIBS="-lGL"
fi
if test "x$with_glu" != "xno"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lGLU" >&5
$as_echo_n "checking for -lGLU... " >&6; }
if ${ac_cv_lib_soname_GLU+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lGLU $OPENGL_LIBS $X_LIBS -lm $X_EXTRA_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char gluLookAt ();
int
main ()
{
return gluLookAt ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_GLU=`$ac_cv_path_LDD conftest.exe | grep "GLU" | sed -e "s/dll.*/dll/"';2,$d'` ;;
dylib) ac_cv_lib_soname_GLU=`$OTOOL -L conftest$ac_exeext | grep "libGLU\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGLU\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_GLU=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGLU\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGLU\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if ${ac_cv_lib_soname_GLU:+false} :; then :
ac_cv_lib_soname_GLU=`$LDD conftest$ac_exeext | grep "libGLU\\.$LIBEXT" | sed -e "s/^.*\(libGLU\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
else
ac_cv_lib_soname_GLU=
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_GLU:+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_GLU" >&5
$as_echo "$ac_cv_lib_soname_GLU" >&6; }

cat >>confdefs.h <<_ACEOF
#define SONAME_LIBGLU "$ac_cv_lib_soname_GLU"
_ACEOF


fi
if test "x$ac_cv_lib_soname_GLU" = "x"; then :
case "x$with_glu" in
x) as_fn_append wine_notices "|libGLU ${notice_platform}development files not found, GLU won't be supported." ;;
xno) ;;
*) as_fn_error $? "libGLU ${notice_platform}development files not found, GLU won't be supported.
This is an error since --with-glu was requested." "$LINENO" 5 ;;
esac

fi
fi

if test "x$with_osmesa" != "xno"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lOSMesa" >&5
Expand Down
8 changes: 0 additions & 8 deletions configure.ac
Expand Up @@ -49,7 +49,6 @@ AC_ARG_WITH(gettext, AS_HELP_STRING([--without-gettext],[do not use gettext]))
AC_ARG_WITH(gettextpo, AS_HELP_STRING([--with-gettextpo],[use the GetTextPO library to rebuild po files]),
[if test "x$withval" = "xno"; then ac_cv_header_gettext_po_h=no; fi])
AC_ARG_WITH(gphoto, AS_HELP_STRING([--without-gphoto],[do not use gphoto (Digital Camera support)]))
AC_ARG_WITH(glu, AS_HELP_STRING([--without-glu],[do not use the GLU library]))
AC_ARG_WITH(gnutls, AS_HELP_STRING([--without-gnutls],[do not use GnuTLS (schannel support)]))
AC_ARG_WITH(gsm, AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 06.10 codec support)]),
[if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; ac_cv_header_gsm_gsm_h=no; fi])
Expand Down Expand Up @@ -1292,13 +1291,6 @@ This probably prevents linking to OpenGL. Try deleting the file and restarting c
fi],
$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)],
$X_LIBS -lm $X_EXTRA_LIBS)
if test "x$with_glu" != "xno"
then
WINE_CHECK_SONAME(GLU,gluLookAt,,,[$OPENGL_LIBS $X_LIBS -lm $X_EXTRA_LIBS])
WINE_NOTICE_WITH(glu,[test "x$ac_cv_lib_soname_GLU" = "x"],
[libGLU ${notice_platform}development files not found, GLU won't be supported.])
fi

if test "x$with_osmesa" != "xno"
then
WINE_CHECK_SONAME(OSMesa,OSMesaGetProcAddress,,,[$X_LIBS -lm $X_EXTRA_LIBS])
Expand Down
110 changes: 33 additions & 77 deletions dlls/glu32/glu.c
Expand Up @@ -20,6 +20,7 @@
#include "config.h"
#include "wine/port.h"

#include <assert.h>
#include <stdarg.h>

#include "windef.h"
Expand Down Expand Up @@ -91,51 +92,6 @@ static const struct { GLuint err; const char *str; } errors[] =
{ GLU_NURBS_ERROR37, "duplicate point on piecewise linear trimming curve" },
};

typedef void (*_GLUfuncptr)(void);

static void (*p_gluBeginCurve)( GLUnurbs* nurb );
static void (*p_gluBeginSurface)( GLUnurbs* nurb );
static void (*p_gluBeginTrim)( GLUnurbs* nurb );
static void (*p_gluDeleteNurbsRenderer)( GLUnurbs* nurb );
static void (*p_gluEndCurve)( GLUnurbs* nurb );
static void (*p_gluEndSurface)( GLUnurbs* nurb );
static void (*p_gluEndTrim)( GLUnurbs* nurb );
static void (*p_gluGetNurbsProperty)( GLUnurbs* nurb, GLenum property, GLfloat* data );
static void (*p_gluLoadSamplingMatrices)( GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view );
static GLUnurbs* (*p_gluNewNurbsRenderer)(void);
static void (*p_gluNurbsCallback)( GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc );
static void (*p_gluNurbsCurve)( GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type );
static void (*p_gluNurbsProperty)( GLUnurbs* nurb, GLenum property, GLfloat value );
static void (*p_gluNurbsSurface)( GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type );
static void (*p_gluPwlCurve)( GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type );

static void *libglu_handle;
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;

static BOOL WINAPI load_libglu( INIT_ONCE *once, void *param, void **context )
{
#ifdef SONAME_LIBGLU
if ((libglu_handle = dlopen( SONAME_LIBGLU, RTLD_NOW )))
TRACE( "loaded %s\n", SONAME_LIBGLU );
else
ERR( "Failed to load %s: %s\n", SONAME_LIBGLU, dlerror() );
#else
ERR( "libGLU is needed but support was not included at build time\n" );
#endif
return libglu_handle != NULL;
}

static void *load_glufunc( const char *name )
{
void *ret;

if (!InitOnceExecuteOnce( &init_once, load_libglu, NULL, NULL )) return NULL;
if (!(ret = dlsym( libglu_handle, name ))) ERR( "Can't find %s\n", name );
return ret;
}

#define LOAD_FUNCPTR(f) (p_##f || (p_##f = load_glufunc( #f )))


/***********************************************************************
* gluErrorString (GLU32.@)
Expand Down Expand Up @@ -173,17 +129,16 @@ const WCHAR * WINAPI wine_gluErrorUnicodeStringEXT( GLenum errCode )
*/
GLUnurbs * WINAPI wine_gluNewNurbsRenderer(void)
{
if (!LOAD_FUNCPTR( gluNewNurbsRenderer )) return NULL;
return p_gluNewNurbsRenderer();
ERR( "Nurbs renderer is not supported, please report\n" );
return NULL;
}

/***********************************************************************
* gluDeleteNurbsRenderer (GLU32.@)
*/
void WINAPI wine_gluDeleteNurbsRenderer( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluDeleteNurbsRenderer )) return;
p_gluDeleteNurbsRenderer( nobj );
assert( 0 );
}

/***********************************************************************
Expand All @@ -192,44 +147,39 @@ void WINAPI wine_gluDeleteNurbsRenderer( GLUnurbs *nobj )
void WINAPI wine_gluLoadSamplingMatrices( GLUnurbs *nobj, const GLfloat modelMatrix[16],
const GLfloat projMatrix[16], const GLint viewport[4] )
{
if (!LOAD_FUNCPTR( gluLoadSamplingMatrices )) return;
p_gluLoadSamplingMatrices( nobj, modelMatrix, projMatrix, viewport );
assert( 0 );
}

/***********************************************************************
* gluNurbsProperty (GLU32.@)
*/
void WINAPI wine_gluNurbsProperty( GLUnurbs *nobj, GLenum property, GLfloat value )
{
if (!LOAD_FUNCPTR( gluNurbsProperty )) return;
p_gluNurbsProperty( nobj, property, value );
assert( 0 );
}

/***********************************************************************
* gluGetNurbsProperty (GLU32.@)
*/
void WINAPI wine_gluGetNurbsProperty( GLUnurbs *nobj, GLenum property, GLfloat *value )
{
if (!LOAD_FUNCPTR( gluGetNurbsProperty )) return;
p_gluGetNurbsProperty( nobj, property, value );
assert( 0 );
}

/***********************************************************************
* gluBeginCurve (GLU32.@)
*/
void WINAPI wine_gluBeginCurve( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluBeginCurve )) return;
p_gluBeginCurve( nobj );
assert( 0 );
}

/***********************************************************************
* gluEndCurve (GLU32.@)
*/
void WINAPI wine_gluEndCurve( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluEndCurve )) return;
p_gluEndCurve( nobj );
assert( 0 );
}

/***********************************************************************
Expand All @@ -238,26 +188,23 @@ void WINAPI wine_gluEndCurve( GLUnurbs *nobj )
void WINAPI wine_gluNurbsCurve( GLUnurbs *nobj, GLint nknots, GLfloat *knot,
GLint stride, GLfloat *ctlarray, GLint order, GLenum type )
{
if (!LOAD_FUNCPTR( gluNurbsCurve )) return;
p_gluNurbsCurve( nobj, nknots, knot, stride, ctlarray, order, type );
assert( 0 );
}

/***********************************************************************
* gluBeginSurface (GLU32.@)
*/
void WINAPI wine_gluBeginSurface( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluBeginSurface )) return;
p_gluBeginSurface( nobj );
assert( 0 );
}

/***********************************************************************
* gluEndSurface (GLU32.@)
*/
void WINAPI wine_gluEndSurface( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluEndSurface )) return;
p_gluEndSurface( nobj );
assert( 0 );
}

/***********************************************************************
Expand All @@ -267,46 +214,39 @@ void WINAPI wine_gluNurbsSurface( GLUnurbs *nobj, GLint sknot_count, float *skno
GLfloat *tknot, GLint s_stride, GLint t_stride, GLfloat *ctlarray,
GLint sorder, GLint torder, GLenum type )
{
if (!LOAD_FUNCPTR( gluNurbsSurface )) return;
p_gluNurbsSurface( nobj, sknot_count, sknot, tknot_count, tknot,
s_stride, t_stride, ctlarray, sorder, torder, type );
assert( 0 );
}

/***********************************************************************
* gluBeginTrim (GLU32.@)
*/
void WINAPI wine_gluBeginTrim( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluBeginTrim )) return;
p_gluBeginTrim( nobj );
assert( 0 );
}

/***********************************************************************
* gluEndTrim (GLU32.@)
*/
void WINAPI wine_gluEndTrim( GLUnurbs *nobj )
{
if (!LOAD_FUNCPTR( gluEndTrim )) return;
p_gluEndTrim( nobj );
assert( 0 );
}

/***********************************************************************
* gluPwlCurve (GLU32.@)
*/
void WINAPI wine_gluPwlCurve( GLUnurbs *nobj, GLint count, GLfloat *array, GLint stride, GLenum type )
{
if (!LOAD_FUNCPTR( gluPwlCurve )) return;
p_gluPwlCurve( nobj, count, array, stride, type );
assert( 0 );
}

/***********************************************************************
* gluNurbsCallback (GLU32.@)
*/
void WINAPI wine_gluNurbsCallback( GLUnurbs *nobj, GLenum which, void (CALLBACK *fn)(void) )
{
if (!LOAD_FUNCPTR( gluNurbsCallback )) return;
/* FIXME: callback calling convention */
p_gluNurbsCallback( nobj, which, (_GLUfuncptr)fn );
assert( 0 );
}

/***********************************************************************
Expand Down Expand Up @@ -339,3 +279,19 @@ GLboolean WINAPI wine_gluCheckExtension( const GLubyte *extName, const GLubyte *
}
return GLU_FALSE;
}

/***********************************************************************
* DllMain
*/
BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, LPVOID reserved )
{
switch (reason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( instance );
break;
}
return TRUE;
}
3 changes: 0 additions & 3 deletions include/config.h.in
Expand Up @@ -1346,9 +1346,6 @@
/* Define to the soname of the libGLESv2 library. */
#undef SONAME_LIBGLESV2

/* Define to the soname of the libGLU library. */
#undef SONAME_LIBGLU

/* Define to the soname of the libgnutls library. */
#undef SONAME_LIBGNUTLS

Expand Down

0 comments on commit ec55b1c

Please sign in to comment.