autoconf: Implement release tarball detection. Fixes #257.
This should finally allow us to address all cases of build errors due to differences between release tarballs and building from git. See also https://github.com/NixOS/nix/issues/506#issuecomment-507312587
This commit is contained in:
parent
cd8bc06e87
commit
82b7f0e840
27
configure.ac
27
configure.ac
|
@ -5,6 +5,19 @@ AC_CONFIG_AUX_DIR(config)
|
|||
|
||||
AC_PROG_SED
|
||||
|
||||
# Detect building from release tarballs (we need less dependencies then)
|
||||
# by checking for the `.dist-files` file present only in release tarballs
|
||||
# (created in release.nix).
|
||||
# For example, we don't need to build the manual or run bison/flex
|
||||
# parser generators for release tarballs, as those have them pre-generated.
|
||||
AC_MSG_CHECKING([whether we are building from a release tarball (.dist-files existence)])
|
||||
if test -f .dist-files; then
|
||||
AC_MSG_RESULT(yes; will not require tools that are not needed for building from release tarballs)
|
||||
building_from_release_tarball=yes;
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Construct a Nix system name (like "i686-linux").
|
||||
AC_CANONICAL_HOST
|
||||
AC_MSG_CHECKING([for the canonical Nix system name])
|
||||
|
@ -119,14 +132,13 @@ if test -z "$$1"; then
|
|||
fi
|
||||
])
|
||||
|
||||
# Note: Usage of `AC_PATH_PROG(..., ..., false)` indicates that this program
|
||||
# is not required in all cases. (e.g. not when building from a release tarball).
|
||||
# The use of `false` isn't ideal, because when used somewhere in the build it
|
||||
# will silently fail without error message; this should be improved.
|
||||
NEED_PROG(bash, bash)
|
||||
NEED_PROG(patch, patch)
|
||||
AC_PATH_PROG(flex, flex, false)
|
||||
AC_PATH_PROG(bison, bison, false)
|
||||
if test "x$building_from_release_tarball" != x"yes"; then
|
||||
# Parser generators are pre-built in release tarballs.
|
||||
NEED_PROG(flex, flex)
|
||||
NEED_PROG(bison, bison)
|
||||
fi
|
||||
NEED_PROG(sed, sed)
|
||||
NEED_PROG(tar, tar)
|
||||
NEED_PROG(bzip2, bzip2)
|
||||
|
@ -260,7 +272,8 @@ AC_ARG_ENABLE(doc-gen, AC_HELP_STRING([--disable-doc-gen],
|
|||
doc_generate=$enableval, doc_generate=yes)
|
||||
AC_SUBST(doc_generate)
|
||||
|
||||
if test "$doc_generate" = yes; then
|
||||
# The manual is pre-generated in release tarballs.
|
||||
if test "$doc_generate" = yes && test "x$building_from_release_tarball" != x"yes"; then
|
||||
# Programs required to build the manual
|
||||
NEED_PROG(xmllint, xmllint)
|
||||
NEED_PROG(xsltproc, xsltproc)
|
||||
|
|
Loading…
Reference in a new issue