Skip to content

Commit ce655f3

Browse files
Release Managervbraun
Release Manager
authored andcommitted
Trac #27567: Add --with-system-<spkg> options to configure
As discussed in other tickets, such as #27373 and #26899, it would sometimes be useful to be able to explicitly specify, at configure-time, whether or not a system package can be used to fulfill some SPKG dependency. With the work being done for #27330, it is currently the case that if an SPKG has a `spkg-configure.m4`, and the checks performed for the system package succeed, then the system package will always be used whether you want to or not. This is a problem because even of the configure-time checks succeed, there could be previously unknown or unanticipated problems with using a particular version of the system package or some package+platform combination. Therefore it is useful (if unfortunate) to be able to force use of the SPKG and disable checking for the system package. In principle we would want to react to the broken package+platform combination as well, either by fixing it somehow or blacklisting that particular combination at configure-time. However, by providing this option, we at least don't have to react immediately to such problems if/when they arise (e.g. #26899). This ticket adds a `--with-system-<spkg>` flag to `configure`; e.g. `--with-system-zlib`. By default this is enabled (the current behavior), but by passing `--with-system-zlib=no` or `--without-system- zlib` then the SPKG will be installed without checking the system for the dependency. This also adds the option to pass `--with-system-zlib=force` meaning that if the dependency cannot be found on the system then configure will abort with an error message. This would effectively replace #21538. URL: https://trac.sagemath.org/27567 Reported by: embray Ticket author(s): Erik Bray Reviewer(s): Dima Pasechnik
2 parents 4aa19b0 + b6aa97f commit ce655f3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

m4/sage_spkg_configure.m4

+21-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ AC_DEFUN_ONCE([SAGE_SPKG_CONFIGURE_]m4_toupper($1), [
3131
m4_pushdef([SPKG_NAME], [$1])
3232
m4_pushdef([SPKG_INSTALL_VAR], [sage_spkg_install_]SPKG_NAME)
3333
m4_pushdef([SPKG_REQUIRE_VAR], [sage_require_]SPKG_NAME)
34+
m4_pushdef([SPKG_USE_SYSTEM], [sage_use_system_]SPKG_NAME)
3435
# BEGIN SAGE_SPKG_CONFIGURE_]m4_toupper($1)[
3536
AC_MSG_NOTICE([=== checking whether to install the $1 SPKG ===])
37+
AC_ARG_WITH([system-]SPKG_NAME,
38+
AS_HELP_STRING(--with-system-SPKG_NAME,
39+
[detect and use an existing system SPKG_NAME (default is yes)]),
40+
[AS_VAR_SET(SPKG_USE_SYSTEM, [$withval])],
41+
[AS_VAR_SET(SPKG_USE_SYSTEM, [yes])]
42+
)
43+
m4_divert_once([HELP_WITH], AS_HELP_STRING(--with-system-SPKG_NAME=force,
44+
[require use of an existing system SPKG_NAME]))
3645
m4_ifval(
3746
[$2],
3847
[AS_VAR_SET_IF(SPKG_INSTALL_VAR, [], SPKG_INSTALL_VAR[=no])],
@@ -42,8 +51,19 @@ AS_VAR_SET_IF(SPKG_REQUIRE_VAR, [], SPKG_REQUIRE_VAR[=no])
4251
$3
4352
],
4453
[AS_VAR_SET_IF(SPKG_REQUIRE_VAR, [], SPKG_REQUIRE_VAR[=yes])])
45-
AS_VAR_IF(SPKG_REQUIRE_VAR, [yes], [$2], SPKG_INSTALL_VAR[=no])
54+
AS_VAR_IF(SPKG_USE_SYSTEM, [no], SPKG_INSTALL_VAR[=yes], [
55+
AS_VAR_IF(SPKG_REQUIRE_VAR, [yes], [$2], SPKG_INSTALL_VAR[=no])
56+
])
57+
AS_VAR_IF(SPKG_USE_SYSTEM, [force], [
58+
AS_VAR_IF(SPKG_INSTALL_VAR, [yes], [
59+
AC_MSG_ERROR(m4_normalize([
60+
given --with-system-]SPKG_NAME[=force but the package could not
61+
be found on the system
62+
]))
63+
])
64+
])
4665
# END SAGE_SPKG_CONFIGURE_]m4_toupper($1)[
66+
m4_popdef([SPKG_USE_SYSTEM])
4767
m4_popdef([SPKG_REQUIRE_VAR])
4868
m4_popdef([SPKG_INSTALL_VAR])
4969
m4_popdef([SPKG_NAME])

0 commit comments

Comments
 (0)