diff options
author | Krzesimir Nowak <qdlacz@gmail.com> | 2011-09-13 13:09:30 +0200 |
---|---|---|
committer | Krzesimir Nowak <qdlacz@gmail.com> | 2011-09-20 16:41:17 +0200 |
commit | 1553ebe1d99082dea2512dcb10aebd237ed53432 (patch) | |
tree | 3c64db35e5328932f41ba5dc70da5923f77a5d37 | |
parent | 3db44499e1e1ac81a4e4d16f2ef831649fb83f44 (diff) | |
download | mm-common-1553ebe1d99082dea2512dcb10aebd237ed53432.tar.gz |
Make downloading tags optional.
Allow networking to be disabled - may be useful for developers with
no connection to Internet. By default networking is paired with
maintainer mode, that is - it is enabled/disabled when maintainer mode
is enabled/disabled.
* configure.ac: Check for networking. Check for wget and curl if
networking is enabled.
* Makefile.am: Use NETWORK_ENABLED condition.
-rw-r--r-- | Makefile.am | 19 | ||||
-rw-r--r-- | configure.ac | 33 |
2 files changed, 44 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 6e5ba02..50d11c1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -123,13 +123,18 @@ download_wget = $(WGET) -N -nd -T 300 -t 5 -P $(dir $@) subst_manpage = $(SED) 's|[@]PACKAGE_STRING[@]|$(PACKAGE_STRING)|g;s|[@]docdir[@]|$(docdir)|g' srctar_stdout = cd $(top_srcdir) >/dev/null && $(TAR) chof - -# If maintainer mode is enabled, always check the remote locations -# of the tag files for updates when building the default target. +# If maintainer mode is enabled and network is enabled then always +# check the remote locations of the tag files for updates when +# building the default target. if MAINTAINER_MODE +if NETWORK_ENABLED check_updates = $(if $(filter all%,$(or $(MAKECMDGOALS),all)),$(dist_doctags_DATA)) else check_updates = endif +else +check_updates = +endif .PHONY: $(check_updates) postinst-acdir-notice @@ -138,9 +143,15 @@ endif # Download the libstdc++ tag file from the GCC website. doctags/libstdc++.tag: - $(AM_V_GEN)$(if\ + $(AM_V_GEN)$(if $(filter no,$(USE_NETWORK)),\ + echo 'Error: $@ does not exist.';\ + echo 'Downloading it is not possible because network is disabled.';\ + echo 'Please run configure script with --enable-network flag.';\ + echo 'Bailing out.' >&2;\ + exit 1;,\ + $(if\ $(CURL),$(download_curl) '$(libstdcxx_tag_url)',$(if\ - $(WGET),$(download_wget) '$(libstdcxx_tag_url)',test -f $@)) + $(WGET),$(download_wget) '$(libstdcxx_tag_url)',test -f $@))) # Build the mm-common-prepare(1) manual page. util/mm-common-prepare.1: $(srcdir)/util/mm-common-prepare.1.in Makefile diff --git a/configure.ac b/configure.ac index 10f2320..d437cc2 100644 --- a/configure.ac +++ b/configure.ac @@ -32,11 +32,36 @@ AC_PROG_SED dnl list of tar execs is taken from the generated ./missing script. AC_CHECK_PROGS([TAR], [tar gnutar gtar], [no]) AS_VAR_IF([TAR], [no], [AC_MSG_ERROR([tar utility not found])]) -AC_CHECK_PROG([CURL], [curl], [curl]) -AC_CHECK_PROG([WGET], [wget], [wget]) -AS_IF([test "x$USE_MAINTAINER_MODE" != xno && test "x$CURL$WGET" = x], - [AC_MSG_FAILURE([[Either curl or wget is required for building mm-common.]])]) +AC_MSG_CHECKING([whether to enable network]) +AC_ARG_ENABLE([network], + [AS_HELP_STRING([--enable-network], + [use network to download tags if needed @<:@default=same as maintainer mode@:>@])], + [AS_VAR_IF([enableval], ['yes'],, + [AS_VAR_IF([enableval], ['no'],, + [AC_MSG_ERROR([[Pass either `yes', `no' or nothing to --enable-network.]])] + ) + ] + ) + AS_VAR_SET([enable_network], ["$enableval"]) + ], + [AS_VAR_SET([enable_network], ["$USE_MAINTAINER_MODE"])] + ) +AC_SUBST([USE_NETWORK], ["$enable_network"]) +AM_CONDITIONAL(NETWORK_ENABLED, [test "x$enable_network" = 'xyes']) +AC_MSG_RESULT([$USE_NETWORK]) + +AS_VAR_IF([USE_NETWORK], ['yes'], + [AC_CHECK_PROG([CURL], [curl], [curl]) + AC_CHECK_PROG([WGET], [wget], [wget]) + AS_VAR_IF([CURL], [], + [AS_VAR_IF([WGET], [], + [AC_MSG_FAILURE([[Network is enabled so either curl or wget is required for building mm-common.]])] + ) + ] + ) + ] + ) AC_CONFIG_FILES([Makefile doctags/mm-common-libstdc++.pc |