Skip to content

Conversation

@blast007
Copy link
Member

@blast007 blast007 commented Sep 9, 2018

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.

Copy link
Member

@macsforme macsforme left a 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.

config.log

@atupone
Copy link
Contributor

atupone commented Sep 12, 2018

if glew is required why there is a need for checking GL ? glew should be enough

@blast007
Copy link
Member Author

@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:

/usr/bin/ld: SceneRenderer.o: undefined reference to symbol 'glColorMask'
//usr/lib/x86_64-linux-gnu/libGL.so.1: error adding symbols: DSO missing from command line

As for the ncurses issue you mentioned on IRC:

< tupone> blast007: for curses we should use the pkg-config, the curses.m4, if needed, should be revisited (IIRC)
< tupone> the previous method did not detect the need of an extra library from ncurses
< tupone> something like libtinfo.so
< blast007> what platform is that an issue with?
< tupone> I remember a bug issued on gentoo by someone.
< tupone> https://bugs.gentoo.org/632022 I think this was

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.

@macsforme
Copy link
Member

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:

configure:21406: g++ -o conftest -g -O2 -std=c++0x   conftest.cpp -lm  >&5

And then the second run is:

configure:21406: g++ -o conftest -g -O2 -std=c++0x   conftest.cpp -lGLEW -framework OpenGL  -lm  >&5

So it looks like AC_SEARCH_LIBS() isn't applying other-libraries to the first (and only, in the case of GL and GLU) run. Would there be a different way we can check the presence of those functions with a given set of GLIBS?

…ry in the right location, and don't check for libraries containing OpenGL and GLU as those are provided by OpenGL.framework.
@blast007 blast007 merged commit 3d02ffc into BZFlag-Dev:2.4 Sep 21, 2018
@blast007 blast007 deleted the cleanup/pkg_config_removal branch September 21, 2018 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants