The configure script does not find GLUT on macOS
macOS ships GLUT/glut.h
instead of GL/glut.h
, which is what the configure script currently tries to find.
Expected Behaviour
I expect the configure script to find GLUT/glut.h
.
Actual Behaviour
The configure script does not find GLUT/glut.h
.
OS Version
macOS Sonoma 14.2.1.
Graphviz Version
HEAD at the time of writing (d7197673).
Additional Info
Here’s an example patch to fix this, using ax_check_glut (doc, impl) from autoconf-archive:
diff --git a/configure.ac b/configure.ac
index 927f6a8..36a43ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1952,31 +1952,9 @@ AC_ARG_WITH(glut,
if test "$with_glut" != "yes"; then
use_glut="No (disabled)"
else
- save_CPPFLAGS=$CPPFLAGS
- save_LDFLAGS=$LDFLAGS
- AC_ARG_WITH(glutincludedir,
- [AS_HELP_STRING([--with-glutincludedir=DIR],[use GLUT includes from DIR])],
- [GLUT_CFLAGS="-I$withval"])
- CPPFLAGS="$CPPFLAGS $GLUT_CFLAGS"
- AC_ARG_WITH(glutlibdir,
- [AS_HELP_STRING([--with-glutlibdir=DIR],[use GLUT libraries from DIR])],
- [GLUT_LIBS="-L$withval"])
- LDFLAGS="$LDFLAGS $GLUT_LIBS"
-
- AC_CHECK_HEADER(GL/glut.h,
- AC_CHECK_LIB(glut,main,
- [GLUT_LIBS="$GLUT_LIBS -lglut"
- use_glut="Yes"
- AC_DEFINE_UNQUOTED(HAVE_GLUT,1,[Define if you have the GLUT library])],
- use_glut="No (missing libglut)"
- AC_MSG_WARN(Optional glut library not available),
- []),
- use_glut="No (missing GL/glut.h)"
- AC_MSG_WARN(Optional glut library not available - no GL/glut.h))
+ AX_CHECK_GLUT([use_glut="Yes"],[use_glut="No (missing)"])
fi
-LDFLAGS=$save_LDFLAGS
-CPPFLAGS=$save_CPPFLAGS
AC_SUBST([GLUT_CFLAGS])
AC_SUBST([GLUT_LIBS])
diff --git a/lib/glcomp/glcompbutton.c b/lib/glcomp/glcompbutton.c
index d0e7cda..71c8a30 100644
--- a/lib/glcomp/glcompbutton.c
+++ b/lib/glcomp/glcompbutton.c
@@ -17,8 +17,16 @@
#include <glcomp/glcompset.h>
#include <stddef.h>
#include <string.h>
+#if HAVE_WINDOWS_H && defined(_WIN32)
+#include <windows.h>
+#endif
+#if defined(HAVE_GL_GLUT_H)
#include <GL/glut.h>
-
+#elif defined(HAVE_GLUT_GLUT_H)
+#include <GLUT/glut.h>
+#else
+#error "no glut.h"
+#endif
glCompButton *glCompButtonNew(glCompObj * par, GLfloat x, GLfloat y,
GLfloat w, GLfloat h, char *caption)
diff --git a/lib/glcomp/glcompfont.c b/lib/glcomp/glcompfont.c
index 6b4a5f6..090bd9d 100644
--- a/lib/glcomp/glcompfont.c
+++ b/lib/glcomp/glcompfont.c
@@ -14,7 +14,16 @@
#include <glcomp/glpangofont.h>
#include <glcomp/glcomptexture.h>
#include <glcomp/glutils.h>
+#if HAVE_WINDOWS_H && defined(_WIN32)
+#include <windows.h>
+#endif
+#if defined(HAVE_GL_GLUT_H)
#include <GL/glut.h>
+#elif defined(HAVE_GLUT_GLUT_H)
+#include <GLUT/glut.h>
+#else
+#error "no glut.h"
+#endif
#include <stddef.h>
static void print_bitmap_string(void *font, char *s)
diff --git a/lib/glcomp/glcompfont.h b/lib/glcomp/glcompfont.h
index 4329135..3b13ae2 100644
--- a/lib/glcomp/glcompfont.h
+++ b/lib/glcomp/glcompfont.h
@@ -18,7 +18,16 @@ typedef float GLfloat;
#endif
#include <glcomp/opengl.h>
#include <glcomp/glcompdefs.h>
+#if HAVE_WINDOWS_H && defined(_WIN32)
+#include <windows.h>
+#endif
+#if defined(HAVE_GL_GLUT_H)
#include <GL/glut.h>
+#elif defined(HAVE_GLUT_GLUT_H)
+#include <GLUT/glut.h>
+#else
+#error "no glut.h"
+#endif
#ifdef __cplusplus
extern "C" {