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

Move headers from configure to compats.h #26

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

paravoid
Copy link
Contributor

configure currently has a lot of ${HAVE_...} -eq 0 ] if blocks, printing out header code for compats.c, to config.h. This is a lot of repetition, does not allow for splitting the code up properly, and makes the configure code a bit less maintainable.

Introduce instead a "compats.h" that should now be included by downstreams, alongside compats.c. Also, add Makefile.regen code to generate said file from the different compat_*.h parts, in the same way compats.c is generated.

The PR is doing this gradually, initially moving all the code that does:

 if [ ${HAVE_...} -eq 0 ]; then
        cat << __HEREDOC__
        ...
__HEREDOC__

Later on, the more tricky ones are being handled, one by one in a separate commit. This is a breaking change for downstreams, in the sense that they're going to need to add another file to their tree.

To review, it may be worth to look at configure.in at the end of the PR, and then review the commits one by one.

I understand this is a wider change, and I expect it to be somewhat controversial :) I didn't open an issue first because I wanted to see how the end result will look like, and now that I see it I think it is much cleaner. YMMV, and no hard feelings if you outright reject it!

Adjust the whitespace in the target definition, to avoid the need for
spurious -/+ to realign when adding additional targets.
configure currently has a lot of ${HAVE_...} -eq 0 ] if blocks, printing
out header code for compats.c, to config.h. This is a lot of repetition,
does not allow for splitting the code up properly, and makes the
configure code a bit less maintainable.

Introduce instead a "compats.h" that should now be included by
downstreams, alongside compats.c. Also, add Makefile.regen code to
generate said file from the different compat_*.h parts, in the same way
compats.c is generated.
Use the new compats.h facility to include the sys_queue.h and sys_tree.h
code. This removes the special-casing of that header code, and the
configure.in/configure.1/configure.2 sed replacements, making the code
cleaner and more aligned to the rest of the compatibility code.
Remove more "if HAVE_..." code from configure, relying on simple
"#include" statements in compat_*.h code instead.
They use size_t but have not been including it (even pre-refactor)
Given this is now a header file, also convert it from using sh/uname to
define it conditionally, to using preprocessor macros.
This lets compats.h define _GNU_SOURCE etc., rather than config.h, and
moves these ifdefs outside of configure.
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