-
Notifications
You must be signed in to change notification settings - Fork 93
Use AC_CHECK_HEADER and AC_SEARCH_LIBS for finding GL/GLU/GLEW and don't depend on pkg-config #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On macOS I get:
checking for OpenGL/gl.h... no
checking for OpenGL/glu.h... no
checking for OpenGL/glew.h... no
BZFlag client .....: no bzflag client binary! (missing OpenGL)
I will try to look at it more later, but in the meantime here is my config.log. It looks like perhaps the -framework OpenGL is not going in the right place.
|
if glew is required why there is a need for checking GL ? glew should be enough |
|
@macsforme, I had the $GLIBS in the wrong spot, so I'm curious if it works now on macOS. @atupone, checking for GL/GLU makes sure they also exist and are usable. That might be unnecessary on macOS, Debian, or Gentoo. I did notice that the binary glew package/lib didn't depend on GLU on Debian, but the dev package has a dependency on GLU. But consider a distribution like Slackware that doesn't do dependency tracking by default. GLEW does have an option to build without GLU as well. Also, without using AC_SEARCH_LIBS for GL/GLU, I end up getting this on my Debian system: As for the ncurses issue you mentioned on IRC: I have the curses.m4 now attempt to use pkg-config if available, falling back to the old way if it doesn't find it or if pkg-config isn't available. |
|
That works better. OpenGL/gl.h and OpenGL/glu.h are now located properly. If OpenGL/glew.h is changed to GL/glew.h, that header is also found in the default install location. I think that should be changed to GL/glew.h, unless someone has any insight whether the 3rd-party macOS package managers (like homebrew) put it under OpenGL/glew.h (maybe @allejo can answer?). The GLEW library is also found properly, but the library searches for the glBegin() and gluScaleImage() functions fail. I read the code and I think I understand the intention. Looking at GLEW's successful pass in my config.log, the first run is: And then the second run is: So it looks like AC_SEARCH_LIBS() isn't applying |
…ry in the right location, and don't check for libraries containing OpenGL and GLU as those are provided by OpenGL.framework.
I replaced some of our AC_LINK_IFELSE macros with AC_CHECK_HEADER and AC_SEARCH_LIBS. I currently special-cased macOS to look at the OpenGL/ include directory instead of GL/, but perhaps that could be simplified by using AC_CHECK_HEADERS instead of AC_CHECK_HEADER. I can't test on mac to know if it even works in the current state. I didn't want to depend on pkg-config which isn't included on a basic Debian install nor needed for a server-only build and without it autoconf would error out. This also reverts a change that made a curses library required even if you didn't care about bzadmin, going back to the old method where it would just build bzadmin without the curses UI.
I did also bump the minimum autoconf version to 2.69 (which is the latest version of autoconf, from April 2012). I'm using a feature first mentioned in the documentation of autoconf 2.65 where AC_SEARCH_LIBS defines a ac_cv_search_function variable, so we should be able to drop back to that if 2.69 is a problem.
This also shows more helpful information in the summary about what dependency is missing (GL, GLU, and/or GLEW). It will still checks for game client dependencies and shows which are missing even if --disable-client is passed, but I didn't want to go crazy with cleanup/refactoring for this.
I have tested this on Debian Stretch (both a Gnome install and a minimal install), Debian Jessie, Ubuntu 14.04 Desktop, CentOS 7, and Fedora 24. I did test it on Ubuntu 12.04 Server with the required autoconf version dropped back to 2.68, and it worked, but 12.04 hasn't been supported for over a year. I'm hoping someone can test a *nix style build on macOS to make sure it works there.