Skip to content

Commit

Permalink
buildsys: add maintainer mode
Browse files Browse the repository at this point in the history
Maintainer mode (on by default) controls whether our build system
automatically regenerates `configure` if `configure.ac` or any of its other
sources changes, by running `autoconf`. Similarly, it regenerates
`src/config.h.in` if necessary by running `autoheader`.

While this is very useful when developing GAP, it can be problematic if a user
wants to compile a release version of GAP but does not have autoconf
installed; or if for some reason the GAP source code is readonly and they want
to run an out-of-tree build. Thus we allow turning this off.
  • Loading branch information
fingolfin committed Apr 14, 2020
1 parent e2b2484 commit 523a034
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ GC_SOURCES = @GC_SOURCES@
COMPAT_MODE = @COMPAT_MODE@
GAPARCH = @GAPARCH@

# maintainer mode
MAINTAINER_MODE = @MAINTAINER_MODE@

# GAP kernel version
GAP_KERNEL_MINOR_VERSION = @gap_kernel_minor_version@
GAP_KERNEL_MAJOR_VERSION = @gap_kernel_major_version@
Expand Down
4 changes: 4 additions & 0 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -1272,13 +1272,15 @@ configure_deps = $(srcdir)/configure.ac $(ACLOCAL_M4)
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck

ifneq ($(MAINTAINER_MODE),no)
$(srcdir)/configure: $(configure_deps)
@if command -v autoconf >/dev/null 2>&1 ; then \
echo "running autoconf" ; \
cd $(srcdir) && autoconf ; \
else \
echo "autoconf not available, proceeding with stale configure" ; \
fi
endif

gen/config.h: gen/stamp-h
@if test ! -f $@; then rm -f gen/stamp-h; else :; fi
Expand All @@ -1289,6 +1291,7 @@ gen/stamp-h: $(srcdir)/src/config.h.in config.status
$(SHELL) ./config.status gen/config.h
echo > $@

ifneq ($(MAINTAINER_MODE),no)
$(srcdir)/src/config.h.in: $(configure_deps)
@if command -v autoheader >/dev/null 2>&1 ; then \
echo "running autoheader" ; \
Expand All @@ -1298,6 +1301,7 @@ $(srcdir)/src/config.h.in: $(configure_deps)
echo "autoheader not available, proceeding with stale config.h" ; \
fi
touch $@
endif

GNUmakefile: $(srcdir)/GNUmakefile.in config.status
$(SHELL) ./config.status $@
Expand Down
22 changes: 22 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,27 @@ AC_ARG_ENABLE([debug],
AC_MSG_CHECKING([whether to enable debug mode])
AC_MSG_RESULT([$enable_debug])

dnl
dnl Maintainer mode (on by default) controls whether our build system
dnl automatically regenerates `configure` if `configure.ac` or any of its
dnl other sources changes, by running `autoconf`. Similarly, it regenerates
dnl `src/config.h.in` if necessary by running `autoheader`.
dnl
dnl While this is very useful when developing GAP, it can be problematic if
dnl a user wants to compile a release version of GAP but does not have
dnl autoconf installed; or if for some reason the GAP source code is readonly
dnl and they want to run an out-of-tree build. Thus we allow turning this
dnl off.
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--disable-maintainer-mode], [disable maintainer mode])],
[],
[enable_maintainer_mode=yes]
)
AC_MSG_CHECKING([whether to enable maintainer-mode mode])
AC_MSG_RESULT([$enable_maintainer_mode])
AC_SUBST([MAINTAINER_MODE], [$enable_maintainer_mode])

dnl
AC_ARG_ENABLE([memory-checking],
[AS_HELP_STRING([--enable-memory-checking], [enable memory checking])],
[AC_DEFINE([GAP_MEM_CHECK], [1], [define if building with memory checking])],
Expand All @@ -222,6 +243,7 @@ AC_ARG_ENABLE([memory-checking],
AC_MSG_CHECKING([whether to enable memory checking])
AC_MSG_RESULT([$enable_memory_checking])

dnl
AC_ARG_ENABLE([valgrind],
[AS_HELP_STRING([--enable-valgrind], [enable valgrind extensions to GASMAN])],
[AC_DEFINE([GAP_MEMORY_CANARY], [1], [define if building with valgrind extensions])],
Expand Down

0 comments on commit 523a034

Please sign in to comment.