From 2b1131cb283d21809861ffd212a01b0e79acd301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 19 Jun 2019 14:26:49 +0200 Subject: [PATCH 1/2] Add AM_MAINTAINER_MODE macro to configure.ac and enable it by default AM_MAINTAINER_MODE macro adds ability to disable rebuilding build file (Makefile.in, configure, ...) when the source file changes. This is important in the CI where the timestamps could get skewed and that triggers the rebuild on every ./configure run. --- aclocal.m4 | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure | 38 +++++++++++++++++++++++ configure.ac | 5 +++ 3 files changed, 129 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index bae4eb7b8f..0abbe84363 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -288,6 +288,92 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_link_flag.m4]) m4_include([m4/ax_check_openssl.m4]) diff --git a/configure b/configure index 9c2a3db5ed..40059aee49 100755 --- a/configure +++ b/configure @@ -826,6 +826,9 @@ build_os build_vendor build_cpu build +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE target_alias host_alias build_alias @@ -877,6 +880,7 @@ LIBNS_API DLZ_DRIVER_RULES' ac_user_opts=' enable_option_checking +enable_maintainer_mode enable_largefile enable_shared enable_static @@ -1581,6 +1585,9 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-maintainer-mode + disable make rules and dependencies not useful (and + sometimes confusing) to the casual installer --disable-largefile omit support for large files --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] @@ -2557,6 +2564,33 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# +# Enable maintainer mode by default, but allow to disable it in the CI +# + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + ac_config_headers="$ac_config_headers config.h" @@ -22730,6 +22764,10 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" diff --git a/configure.ac b/configure.ac index bb62f5d533..eda04d4566 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,11 @@ AC_INIT(BIND, [9.15], [info@isc.org], [], [https://www.isc.org/downloads/BIND/]) AC_PREREQ([2.60]) +# +# Enable maintainer mode by default, but allow to disable it in the CI +# +AM_MAINTAINER_MODE([enable]) + AC_CONFIG_HEADER(config.h) AC_CONFIG_MACRO_DIR([m4]) From 0bdc3df5a0822a06d3ecc1d0e4d052d6445c9dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 19 Jun 2019 14:30:32 +0200 Subject: [PATCH 2/2] Run autoreconf -fi in precheck phase and disable maintainer mode in build jobs --- .gitlab-ci.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3232f1173..4ad6e7ab3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -101,15 +101,27 @@ stages: <<: *debian_sid_amd64_image stage: precheck +autoconf: &autoconf_job + <<: *default_triggering_rules + <<: *debian_sid_amd64_image + stage: precheck + script: + - autoreconf -fi + artifacts: + untracked: true + expire_in: "1 hour" + .build: &build_job <<: *default_triggering_rules stage: build before_script: - test -w "${CCACHE_DIR}" && export PATH="/usr/lib/ccache:${PATH}" script: - - ./configure --enable-developer --with-libtool --disable-static --with-cmocka --prefix=$HOME/.local --without-make-clean $EXTRA_CONFIGURE || cat config.log + - ./configure --disable-maintainer-mode --enable-developer --with-libtool --disable-static --with-cmocka --prefix=$HOME/.local --without-make-clean $EXTRA_CONFIGURE || cat config.log - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1 - test -z "${RUN_MAKE_INSTALL}" || make install + dependencies: + - autoreconf:sid:amd64 artifacts: untracked: true expire_in: "1 hour" @@ -151,6 +163,9 @@ stages: # Jobs in the precheck stage +autoreconf:sid:amd64: + <<: *autoconf_job + misc:sid:amd64: <<: *precheck_job script: @@ -188,6 +203,8 @@ docs:sid:amd64: - ./configure || cat config.log - make -C doc/misc docbook - make -C doc/arm Bv9ARM.html + dependencies: + - autoreconf:sid:amd64 artifacts: paths: - doc/arm/