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

Autotools build system #8

Merged
merged 7 commits into from
Feb 19, 2018
Merged

Conversation

StefansM
Copy link
Contributor

Add an autotools build system. Compared to the existing Makefile, this provides install and uninstall targets, more robust tests for curses, more compiler warnings, and a dist target to build a release tarball.

The downside is that building a version of this directly from git will require autotools. I've used a few macros from the autoconf archive in configure.ac, so the user will also need the autoconf archive. This won't be a problem when we make a release or for packaged versions, which will either be based on a release or point to the git repository and include autotools as a build dependency.

I would like for this to supersede #6 if there are no objections to the more complex build system.

Add `configure.ac` and `Makefile.am` for generating a configure script
and Makefile. To match with convention, source files have been moved
into the `src` subdirectory.

The build files can be generated with `autoreconf -i`. We make use of
some extensions (`AX_*` macros), so we  require the build machone to
have the autoconf archive installed (`autoconf-archive` on Arch Linux).

Note that as many compiler warnings as possible are enabled by default.
For development versions (i.e. commits not tagged with a version string)
of the code, warnings will cause an error. Release versions are slightly
more slack, and will just emit warnings: this is a feature of the
`AX_COMPILER_FLAGS` macro, and is the intended behaviour.
This cleans up some code smell:

* Explicitly declare functions that take no arguments like `foo(void)`
  rather than `foo()`. We should now get compiler errors when calling
  zero-argument functions with arguments.

* Remove (completely benign) signed/unsigned comparison in loop counter.

* Add the `noreturn` attribute to `die()`. We do an explicit check for
  the `stdnoreturn.h` header so we can compile on non-C11 systems.
Without this the tarballs produced by `make dist` were broken.
Autotools automatically uses a cached version of `configure` if
`configure.ac` has not changed since `autoreconf` was last run. We want
`git describe` to update `PACKAGE_VERSION` in `configure` no matter
what, so this commit adds an `.autm4te.cfg` that stops `configure` being
cached.
Bump the required version of autoconf to 2.64. It was previously 2.63,
which is *really* old (2008), and unsupported by the third-party macros
we are using.

This commit also adds the `AM_PROG_CC_C_O` macro, which is now obsolete
but is required by older (e.g. 2.69 as shipped with RHEL7) versions of
autotools.
Copy link
Contributor

@livibetter livibetter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating .gitignore?

The following was what I got from git status after make:

        Makefile
        Makefile.in
        aclocal.m4
        autoconf-archive/
        compile
        config.h
        config.h.in
        config.log
        config.status
        configure
        depcomp
        install-sh
        missing
        src/.deps/
        src/.dirstamp
        stamp-h1

@StefansM
Copy link
Contributor Author

@livibetter Good call. I'm going to merge this now so there is a good base to work off of for future changes.

@StefansM StefansM merged commit 166f6cf into pipeseroni:master Feb 19, 2018
@StefansM StefansM deleted the build-system branch February 20, 2018 22:54
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.

2 participants