[project @ 2003-12-28 13:02:46 by panne]
[ghc-hetmet.git] / aclocal.m4
index ea3c4b2..ab6ec27 100644 (file)
@@ -997,7 +997,21 @@ else
       test -n "$x_libraries" && GL_LIBS="-L$x_libraries -lX11 $GL_LIBS"
     fi
 
-    FP_CHECK_GL_HELPER([GL], [-lopengl32 -lGL], [@%:@include <GL/gl.h>], [glEnd()])
+    FP_CHECK_GL_HELPER([GL], [-lGL -lopengl32], [@%:@include <GL/gl.h>], [glEnd()])
+
+    if test x"$no_GL" != xyes; then
+      # Ugly: To get wglGetProcAddress on Windows, we have to link with
+      # opengl32.dll, too, even when we are using Cygwin with X11.
+      case "$GL_LIBS" in
+        *-lopengl32*|*opengl32.lib*) ;;
+        *) fp_save_LIBS="$LIBS"
+           LIBS="$LIBS -lopengl32"
+           AC_TRY_LINK([@%:@include <GL/gl.h>], [glEnd()],
+             [GL_LIBS="$GL_LIBS -lopengl32"; GL_LIBS0="$GL_LIBS0 -lopengl32"])
+           LIBS="$fp_save_LIBS"
+           ;;
+      esac
+    fi
   fi
 fi