Support autoconf's --runstatedir option.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 4 Nov 2017 13:17:27 +0000 (14:17 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 4 Nov 2017 13:17:27 +0000 (14:17 +0100)
Put the PID file in @runstatedir@ instead of @localstatedir@/run. This
requires autoconf 2.70, which is not released yet, so add a fallback to
use @localstatedir@/run if @runstatedir@ is not set.

configure.ac
doc/Makefile.am
doc/tinc.conf.5.in
doc/tinc.texi
doc/tincd.8.in
doc/tincinclude.texi.in
src/Makefile.am
src/tincd.c
src/uml_device.c
src/vde_device.c

index e4079bb5fa666e87ec287cc946a515d579dda24d..7287726827d67fe8d85baf905bb1a8d843bb82d4 100644 (file)
@@ -242,6 +242,11 @@ AC_ARG_ENABLE(jumbograms,
   ]
 )
 
   ]
 )
 
+dnl Ensure runstatedir is set if we are using a version of autoconf that does not suppport it
+if test "x$runstatedir" = "x"; then
+  AC_SUBST([runstatedir], ['${localstatedir}/run'])
+fi
+
 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distro/Makefile])
 
 AC_OUTPUT
 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distro/Makefile])
 
 AC_OUTPUT
index 16b5a71ca4f231684a7cec72d018da9df5a2d748..fed46b75215fcb645f569f637c323303ac4dc77a 100644 (file)
@@ -21,6 +21,7 @@ substitute = sed \
        -e s,'@PACKAGE\@',"$(PACKAGE)",g \
        -e s,'@VERSION\@',"$(VERSION)",g \
        -e s,'@sysconfdir\@',"$(sysconfdir)",g \
        -e s,'@PACKAGE\@',"$(PACKAGE)",g \
        -e s,'@VERSION\@',"$(VERSION)",g \
        -e s,'@sysconfdir\@',"$(sysconfdir)",g \
+       -e s,'@runstatedir\@',"$(runstatedir)",g \
        -e s,'@localstatedir\@',"$(localstatedir)",g
 
 tincd.8: $(srcdir)/tincd.8.in
        -e s,'@localstatedir\@',"$(localstatedir)",g
 
 tincd.8: $(srcdir)/tincd.8.in
index 40ea1cc70918e31b4053f848fcc0b4b6866b4193..cd7d1a0d2e268e26a3550055b1f22fe18696d240 100644 (file)
@@ -222,7 +222,7 @@ Also note that this can cause decrypted VPN packets to be sent out on a real net
 Create a UNIX socket with the filename specified by
 .Va Device ,
 or
 Create a UNIX socket with the filename specified by
 .Va Device ,
 or
-.Pa @localstatedir@/run/ Ns Ar NETNAME Ns Pa .umlsocket
+.Pa @runstatedir@/ Ns Ar NETNAME Ns Pa .umlsocket
 if not specified.
 .Nm tinc
 will wait for a User Mode Linux instance to connect to this socket.
 if not specified.
 .Nm tinc
 will wait for a User Mode Linux instance to connect to this socket.
@@ -231,7 +231,7 @@ Uses the libvdeplug library to connect to a Virtual Distributed Ethernet switch,
 using the UNIX socket specified by
 .Va Device ,
 or
 using the UNIX socket specified by
 .Va Device ,
 or
-.Pa @localstatedir@/run/vde.ctl
+.Pa @runstatedir@/vde.ctl
 if not specified.
 .El
 Also, in case tinc does not seem to correctly interpret packets received from the virtual network device,
 if not specified.
 .El
 Also, in case tinc does not seem to correctly interpret packets received from the virtual network device,
index db35b4a30b851b0c29a32cd55daa2b6b933c581b..f4c866ef97a9478c49c0b874016b63badf5cf835 100644 (file)
@@ -860,7 +860,7 @@ Also note that this can cause decrypted VPN packets to be sent out on a real net
 @cindex UML
 @item uml (not compiled in by default)
 Create a UNIX socket with the filename specified by
 @cindex UML
 @item uml (not compiled in by default)
 Create a UNIX socket with the filename specified by
-@var{Device}, or @file{@value{localstatedir}/run/@var{netname}.umlsocket}
+@var{Device}, or @file{@value{runstatedir}/@var{netname}.umlsocket}
 if not specified.
 Tinc will wait for a User Mode Linux instance to connect to this socket.
 
 if not specified.
 Tinc will wait for a User Mode Linux instance to connect to this socket.
 
@@ -868,7 +868,7 @@ Tinc will wait for a User Mode Linux instance to connect to this socket.
 @item vde (not compiled in by default)
 Uses the libvdeplug library to connect to a Virtual Distributed Ethernet switch,
 using the UNIX socket specified by
 @item vde (not compiled in by default)
 Uses the libvdeplug library to connect to a Virtual Distributed Ethernet switch,
 using the UNIX socket specified by
-@var{Device}, or @file{@value{localstatedir}/run/vde.ctl}
+@var{Device}, or @file{@value{runstatedir}/vde.ctl}
 if not specified.
 @end table
 
 if not specified.
 @end table
 
@@ -1730,7 +1730,7 @@ Write log entries to a file instead of to the system logging facility.
 If @var{file} is omitted, the default is @file{@value{localstatedir}/log/tinc.@var{netname}.log}.
 
 @item --pidfile=@var{file}
 If @var{file} is omitted, the default is @file{@value{localstatedir}/log/tinc.@var{netname}.log}.
 
 @item --pidfile=@var{file}
-Write PID to @var{file} instead of @file{@value{localstatedir}/run/tinc.@var{netname}.pid}.
+Write PID to @var{file} instead of @file{@value{runstatedir}/tinc.@var{netname}.pid}.
 
 @item --bypass-security
 Disables encryption and authentication.
 
 @item --bypass-security
 Disables encryption and authentication.
index 195869b60cd14812a4e93a74383bff6d24984500..bdccf9d7a14ed321eae7fa97a0f0af255e81b37f 100644 (file)
@@ -109,7 +109,7 @@ is omitted, the default is
 Write PID to
 .Ar FILE
 instead of
 Write PID to
 .Ar FILE
 instead of
-.Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid.
+.Pa @runstatedir@/tinc. Ns Ar NETNAME Ns Pa .pid.
 Under Windows this option will be ignored.
 .It Fl -bypass-security
 Disables encryption and authentication of the meta protocol.
 Under Windows this option will be ignored.
 .It Fl -bypass-security
 Disables encryption and authentication of the meta protocol.
@@ -190,7 +190,7 @@ This will log all network traffic over the virtual private network.
 Directory containing the configuration files tinc uses.
 For more information, see
 .Xr tinc.conf 5 .
 Directory containing the configuration files tinc uses.
 For more information, see
 .Xr tinc.conf 5 .
-.It Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid
+.It Pa @runstatedir@/tinc. Ns Ar NETNAME Ns Pa .pid
 The PID of the currently running
 .Nm
 is stored in this file.
 The PID of the currently running
 .Nm
 is stored in this file.
index da4adc57d51d550385e05f106ca9e8c92f08bbd2..01fee35e3af2192b495f81c9e633c9798eb1b63d 100644 (file)
@@ -2,3 +2,4 @@
 @set PACKAGE @PACKAGE@
 @set sysconfdir @sysconfdir@
 @set localstatedir @localstatedir@
 @set PACKAGE @PACKAGE@
 @set sysconfdir @sysconfdir@
 @set localstatedir @localstatedir@
+@set runstatedir @runstatedir@
index 508310358d361ebe064e3d537a01e647027573c7..7b3dd97db495a2c26020bfe140dca3707a348df7 100644 (file)
@@ -86,4 +86,4 @@ if TUNEMU
 LIBS += -lpcap
 endif
 
 LIBS += -lpcap
 endif
 
-AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -I $(abs_top_builddir)/
+AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -I $(abs_top_builddir)/
index a8b13ecb90f664f9f1a0ee15696b8aabb946fa00..279c8723b7dcbd0309054a4ae7f90b9f8a5014c7 100644 (file)
@@ -538,7 +538,7 @@ static void make_names(void) {
 #endif
 
        if(!pidfilename) {
 #endif
 
        if(!pidfilename) {
-               xasprintf(&pidfilename, LOCALSTATEDIR "/run/%s.pid", identname);
+               xasprintf(&pidfilename, RUNSTATEDIR "/%s.pid", identname);
        }
 
        if(!logfilename) {
        }
 
        if(!logfilename) {
index 5c9a306e639e1ca0028403dba509aed03d593647..ee9e03f4291419aa3372348888b2053b543f9178 100644 (file)
@@ -65,7 +65,7 @@ static bool setup_device(void) {
        struct timeval tv;
 
        if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
        struct timeval tv;
 
        if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
-               xasprintf(&device, LOCALSTATEDIR "/run/%s.umlsocket", identname);
+               xasprintf(&device, RUNSTATEDIR "/%s.umlsocket", identname);
        }
 
        get_config_string(lookup_config(config_tree, "Interface"), &iface);
        }
 
        get_config_string(lookup_config(config_tree, "Interface"), &iface);
index d97a694fb1b27ad49bbd71531fb184737bceffd6..20302b0d9f44ff3e0cad0c8daa60a2c744678e9c 100644 (file)
@@ -50,7 +50,7 @@ static bool setup_device(void) {
        }
 
        if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
        }
 
        if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
-               xasprintf(&device, LOCALSTATEDIR "/run/vde.ctl");
+               xasprintf(&device, RUNSTATEDIR "/vde.ctl");
        }
 
        get_config_string(lookup_config(config_tree, "Interface"), &iface);
        }
 
        get_config_string(lookup_config(config_tree, "Interface"), &iface);