Skip to content
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

Automatically search for GMP and GNU Readline in a few additional places, if we cannot find them elsewhere #1945

Closed
fingolfin opened this issue Nov 23, 2017 · 4 comments · Fixed by #5214
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: build system
Milestone

Comments

@fingolfin
Copy link
Member

When searching for GMP and GNU Readline, if we fail to detect them w/o specific compiler flags, then we could iterate over a list of standard locations where they might be found instead. Specifically, for OS X, that could be the include and lib subdirectories of...

  • /sw, for a typical Fink installation;
  • /opt/local, for a typical MacPorts install;
  • $(brew --prefix) for Homebrew (and for GNU Readline, also $(brew --prefix)/opt/readline as it is installed keg-only by default)

I am not sure if any other operating system resp. distros would benefit from it, but I'd think it'd be worth the effort regardless of that.

@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Jan 27, 2019
@fingolfin
Copy link
Member Author

With macOS 11 "Big Sur", this is getting more important, as there, Homebrew is installed into /opt/homebrew, and so GAP won't find its GMP or readline unless the user specifies flags.

@fingolfin
Copy link
Member Author

For now, this is what I did on an M1 Mac:

export HOMEBREW_PREFIX=$(brew --prefix)
./configure --with-gmp=$HOMEBREW_PREFIX --with-readline=$HOMEBREW_PREFIX/opt/readline

@fingolfin
Copy link
Member Author

Alternatively, we could also offer a --with-homebrew[=PREFIX] option (if not prefix is given, it would try to look for a brew command and use brew --prefix).

This could then also alter the default for --with-readline so that it looks in the right dir.

But of course overall it'd still be nicest if users could just do ./configure && make and it would "just work" by default -- but I'd be careful to preserve the ability to override / disable any such defaults, because the user may explicitly want to build GAP against a different readline/GMP/zlib, or build without readline support, etc. -- e.g. for testing purposes. I'll leave open how this override works (e.g. --without-readline or --with-gmp=builtin or --with-zlib=ALTERNATE-ZLIB-PATH etc. could do it -- that's how it's done right now, I think).

This is not hard to ensure, as long as one is aware of the need to do so, which is why I mention it here explicitly :-).

@fingolfin
Copy link
Member Author

Oh and note that autoconf already has features which take a list of possible prefixes and search for tools / headers / libraries in there. So a standard thing configure scripts do is to have a list of locations to search, and augment that depending on the target system: E.g. searchpaths=/usr /usr/local and then append /opt/homebrew or /sw (Fink) or /opt/local (MacPorts) or $(brew --prefix) (Homebrew, Linuxbrew?, ...) etc. as needed -- some configure scripts even have an option like --with-searchpath=PREFIX that allows the user to specify additional such search paths.

This can be super convenient -- however, it can also be super frustrating to some users, and esp. to packagers, if it cannot be turned off / overridden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: build system
Projects
None yet
1 participant