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

Improve cross-compilation support [once autoconf 2.70 is widespread] #1199

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jmarshall
Copy link
Member

@jmarshall jmarshall commented Jan 4, 2021

As noted in PR #1198, autoconf 2.70 is more careful about cross compilation and with this autoconf version using AC_FUNC_MMAP implicitly pulls in AC_CANONICAL_HOST and the cross-compilation infrastructure. So we might as well use AC_CANONICAL_HOST explicitly and improve our "shared library type" check (using the formal platform triplet rather than our own ad hoc uname invocation), regardless of autoconf version.

However using AC_CANONICAL_HOST causes autoconf 2.69 or earlier to search for install-sh unconditionally. So we might as well also add AC_PROG_INSTALL and use @INSTALL@ (though this loses -p).

All this requires the config.guess, config.sub, and install-sh support scripts. With autoconf 2.70 autoreconf ‑i/‑‑install creates these files. However this is not the case for previous versions of autoconf, so with those users would have to copy these files into their Git checkout from elsewhere themselves. Hence making this change is not worthwhile until autoconf 2.70 is a lot more widespread than it is at present. (At that point, our hand will have been forced w.r.t. these support files as config.guess and config.sub will be implicitly required anyway.)

Alternatives would be to:

  • Check these three scripts into the repository instead of git-ignoring them, but it's preferable not to check in these externally-supplied scripts. (OTOH the release tarball-making scripts will have to take steps to ensure they are present in the generated tarballs.)

  • Not use AC_FUNC_MMAP, which is currently the only thing causing the cross-compilation machinery to be activated in autoconf 2.70. But I suspect the writing is on the wall and in future even just checking for C header files will activate this machinery too.

This draft adds notes about these support scripts to the instructions. Probably it's about time the README.md instructions were reformatted more like those in INSTALL to emphasise use of autoreconf.

As CI environments are updated to use autoconf 2.70, they also will need to start using autoreconf --install or similar to ensure the support scripts are present.

Autoconf 2.70 is more careful about cross compilation, so with this
version using AC_FUNC_MMAP implicitly pulls in AC_CANONICAL_HOST.
So we might as well use AC_CANONICAL_HOST explicitly and improve
our "shared library type" check, regardless of autoconf version.

Using AC_CANONICAL_HOST causes autoconf 2.69 or earlier to search for
install-sh unconditionally. So we might as well also add AC_PROG_INSTALL
and use @install@.

This requires the config.guess, config.sub, and install-sh support scripts.
Add instructions about how to add them to a Git checkout. (Release tarballs
will also have to take steps to ensure they are present.) In autoconf 2.70
(but not previous versions), autoreconf -i/--install creates these files.
@jmarshall
Copy link
Member Author

jmarshall commented Jan 4, 2021

(CI failed because even with autoconf 2.69 this PR will need to fix the CI scripts to make install-sh and the other two available. Oops.)

@jmarshall
Copy link
Member Author

FYI Apple no longer supplies autoconf, so many macOS users will install it via Homebrew. As of last week (March 29th), brew provides autoconf 2.71. Many other macOS users will install it via MacPorts, which updated 2.69 → 2.71 on March 7th.

So the future is now on macOS.

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.

1 participant