configure: add --with-runstatedir option to configure

Nowadays, it's adivisable to use "/run" instead of "/var/run" ([1]). This is because
"/var" might not be mounted in early boot, during shutdown, or during rescue mode.

Autoconf 2.70 will add an option --runstatedir ([2], [3]). However, the latest
autoconf release is 2.69 from April 2012, so this might take a while longer. Note
that some distributions patched their autoconf 2.69 to support --runstatedir [4],
but not Fedora.

See also [5], [6] for when we added support for autoconf 2.70's
"--runstatedir".

Add a "--with-runstatedir" option that we can use. Note that this
overwrites autoconf's "--runstatedir" (should it be supported). That
makes sense, because this way the user can set the option regardless of
whether autoconf supports "--runstatedir".

For example, Xen did something similar [7].

Meson currently does not support this either. I will not add a
workaround, because there is hope that it will be eventually fixed [8].
Also, autotools is still our default way for building. There is a
NetworkManager issue about this ([9]), which is still unfixed.

[1] http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html
[2] https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
[3] https://lists.gnu.org/archive/html/bug-autoconf/2013-09/msg00000.html
[4] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759647
[5] https://bugzilla.gnome.org/show_bug.cgi?id=737139
[6] commit cd3c52a24d ('build: support runstatedir configure option')
[7] https://patchwork.kernel.org/patch/9576621/
[8] https://github.com/mesonbuild/meson/issues/4141
[9] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/24
This commit is contained in:
Thomas Haller 2019-05-14 09:26:44 +02:00
parent b32ad2344e
commit 921b7eb716

View file

@ -115,7 +115,14 @@ GETTEXT_PACKAGE=NetworkManager
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
# Add runstatedir if not specified manually in autoconf < 2.70
# autoconf 2.70 adds option --runstatedir. To make the directory also configurable
# on older versions, add --with-runstatedir option. Note that this option overwrites
# --runstatedir (should it be set). If you know to use autoconf >= 2.70, you should
# instead use --runstatedir.
AC_ARG_WITH([runstatedir],
AS_HELP_STRING([--with-runstatedir=DIR],
[Directory for /var/run. Defaults to $localstatedir/run. In autoconf >= 2.70, you should instead use --runstatedir option. This option takes precedence over --runstatedir.]),
[runstatedir="$withval"])
AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run")
AC_SUBST(runstatedir)