From: "cron2 (Code Review)" Date: Thu, 27 Nov 2025 11:38:34 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="sAVfc9SQbPg="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: configure/CMake: Unify Windows handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --sAVfc9SQbPg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1410?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by plaisthos Change subject: configure/CMake: Unify Windows handling ...................................................................... configure/CMake: Unify Windows handling Some things were detected in configure.ac and just hard-coded in CMake. Move the hard-coding to syshead.h instead and remove the additional code in configure.ac. These are really Windows-specific so I think not dynamically detecting is okay. Change-Id: Ic55e1288b0d3160e68eef07ff4edbb070a03dd31 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1410 Message-Id: <20251127103710.29341-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 736.html Signed-off-by: Gert Doering --- M config.h.cmake.in M configure.ac M src/openvpn/syshead.h 3 files changed, 29 insertions(+), 83 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1410/3 diff --git a/config.h.cmake.in b/config.h.cmake.in index f68ea27..bf1388c 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -411,32 +411,3 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif - -/* if inttypes.h is included this breaks rc.exe when using the ClangCL - * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does - * not understand (#include_next preprocessor directive) */ -#if defined(_WIN32) && !defined(RC_INVOKED) -#include -typedef uint32_t in_addr_t; -typedef uint16_t in_port_t; - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGUSR1 10 -#define SIGUSR2 12 -#define SIGTERM 15 -#endif - -#if defined(_MSC_VER) && !defined(RC_INVOKED) -#include -typedef SSIZE_T ssize_t; -#define strncasecmp strnicmp -#define strcasecmp _stricmp - -#define S_IRUSR _S_IREAD -#define S_IWUSR _S_IWRITE -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#define F_OK 0 -#endif diff --git a/configure.ac b/configure.ac index 60799e0..73b388b 100644 --- a/configure.ac +++ b/configure.ac @@ -527,18 +527,6 @@ [[${SOCKET_INCLUDES}]] ) -AC_CHECK_TYPES( - [in_addr_t], - , - [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])], - [[${SOCKET_INCLUDES}]] -) -AC_CHECK_TYPES( - [in_port_t], - , - [AC_DEFINE([in_port_t], [uint16_t], [Workaround missing in_port_t])], - [[${SOCKET_INCLUDES}]] -) AC_CHECK_TYPE( [struct msghdr], [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket = error support])], @@ -600,48 +588,6 @@ ) LDFLAGS=3D"$saved_LDFLAGS" -dnl We emulate signals in Windows -AC_CHECK_DECLS( - [SIGHUP], - , - [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGINT], - , - [AC_DEFINE([SIGINT], [2], [SIGINT replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGUSR1], - , - [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGUSR2], - , - [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])], - [[ - #include - ]] -) -AC_CHECK_DECLS( - [SIGTERM], - , - [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])], - [[ - #include - ]] -) - AC_FUNC_FORK AC_CHECK_FUNCS([ \ diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index c6f2608..627ba92 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -44,6 +44,35 @@ #define srandom srand #endif +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) +#include +typedef uint32_t in_addr_t; +typedef uint16_t in_port_t; + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGUSR1 10 +#define SIGUSR2 12 +#define SIGTERM 15 +#endif + +#if defined(_MSC_VER) && !defined(RC_INVOKED) +#include +typedef SSIZE_T ssize_t; +#define strncasecmp strnicmp +#define strcasecmp _stricmp + +#define S_IRUSR _S_IREAD +#define S_IWUSR _S_IWRITE +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 +#endif + #if defined(_MSC_VER) && !defined(__clang__) /* Microsoft compiler */ #define __func__ __FUNCTION__ #define __attribute__(x) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1410?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ic55e1288b0d3160e68eef07ff4edbb070a03dd31 Gerrit-Change-Number: 1410 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --sAVfc9SQbPg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #3 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by plaisthos

configure/CMake: Unify Windows =
handling

Some things were detected in configure.ac and just
hard-= coded in CMake. Move the hard-coding to
syshead.h instead and remove the= additional code
in configure.ac. These are really Windows-specific
s= o I think not dynamically detecting is okay.

Change-Id: Ic55e1288b0d= 3160e68eef07ff4edbb070a03dd31
Signed-off-by: Frank Lichtenheld <frank= @...2641...>
Acked-by: Arne Schwabe <arne-openvpn@...1227...>Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1410
Message-Id: &l= t;20251127103710.29341-1-gert@...1296...>
URL: https://www.mail-archi= ve.com/openvpn-devel@lists.sourceforge.net/msg34736.html
Signed-off-by: = Gert Doering <gert@...1296...>
---
M config.h.cmake.in
M con= figure.ac
M src/openvpn/syshead.h
3 files changed, 29 insertions(+), = 83 deletions(-)

git pull ssh://gerrit.openvpn.ne=
t:29418/openvpn refs/changes/10/1410/3
diff --git a/config.h.cmake.=
in b/config.h.cmake.in
index f68ea27..bf1388c 100644=
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -411,32 +411,3 @@
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
-

-/* if inttypes.h is included this breaks rc.exe when usi= ng the ClangCL
- * Tool= chain as it pulls in a inttypes.h variant for clang that rc.exe does=
- * not understand (#include_= next preprocessor directive) */
-#if defined(_WIN32) && !defined(RC_INVOKED)
-#include <inttypes.h>
<= br>-typedef uint32_t in_addr_t;
-typedef uint16_t in_por= t_t;
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGUSR1 10
-#define SIGUSR2 12
-#define SIGTERM 15
-#endif
-
-#if = defined(_MSC_VER) && !defined(RC_INVOKED)
-#include <BaseTsd.h>
-typedef SSIZE_T ssize_t;
-#define strncasecmp strnicmp
= -#define strcasecmp _stricmp
-
-#define S_IRUSR _S_IREAD
-#define S_IWUSR _S_IWRITE
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#define F_OK 0
-#endif
diff --git a/configure.ac b/configure.ac
index 60799e0..73b388b 100644
--- a/configure.= ac
+++ b/configure.ac
@@ -527,18 +527,6 @@<= /span>
[[${SOCKET_INCLUDES}]]
)

-AC_CHECK_TYPES(
- [in_addr_t],
<= span style=3D"color: hsl(0, 100%, 40%);">- ,

- [AC_DEFINE([in_addr_t], [uint32_t], [Workaround mis= sing in_addr_t])],
- [[= ${SOCKET_INCLUDES}]]
-)=
-AC_CHECK_TYPES(
- [in_port_t],
- ,

- [AC_DEFINE([in_port_t], [uint16_t], [Workaround missi= ng in_port_t])],
- [[${= SOCKET_INCLUDES}]]
-)
AC_CHECK_TYPE(
[struct msghdr], [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended = socket error support])],
@@ -600,48 +588,6 @@
)

LDFLAGS=3D"$saved_LDFLAGS"

-dnl We emulate sign= als in Windows
-AC_CHEC= K_DECLS(
- [SIGHUP],
- ,
- [AC_DEFINE([SIGHUP], [1], [SIGHUP replacem= ent])],
- [[
= - #include <signal.h>
- ]]
-)
-AC_CHECK_DECLS(
- [SIGINT],
- ,
- [AC_DEFINE([SIGINT], [2= ], [SIGINT replacement])],
- [[
- #include &l= t;signal.h>
- ]]
-)
-AC_CHECK_DECLS(
- [SIGUSR1],
- ,
- [A= C_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
- [[
- #include <signal.h>
- ]]
-)=
-AC_CHECK_DECLS(
- [SIGUSR2],
- ,

- [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
- [[
- #include <signal.h>
- ]]

-)
= -AC_CHECK_DECLS(
- [SIG= TERM],
- ,
- [AC_DEFINE([SIGTERM], [15], [SIGT= ERM replacement])],

- [= [
- #include <signa= l.h>
- ]]
= -)
-
AC_FUNC_FORK

AC_CHECK_FUNCS([ \
diff --git a/src/openvpn/s= yshead.h b/src/openvpn/syshead.h
index c6f2608..627ba92 100= 644
--- a/src/openvpn/syshead.h
+++ b/src/o= penvpn/syshead.h
@@ -44,6 +44,35 @@
#defin= e srandom srand
#endif

+/* if inttypes.h is included this br= eaks rc.exe when using the ClangCL
+ * Toolchain as it pulls in a inttypes.h variant for clang t= hat rc.exe does
+ * n= ot understand (#include_next preprocessor directive) */
+#if defined(_WIN32) && !defined= (RC_INVOKED)
+#includ= e <inttypes.h>
= +typedef uint32_t in_addr_t;
+typedef uint16_t in_port_t;
+
+#d= efine SIGHUP 1
+#def= ine SIGINT 2
+#defin= e SIGUSR1 10
+#define= SIGUSR2 12
+#define = SIGTERM 15
+#endif
+
+#if defined(_MSC_VER) && !defined= (RC_INVOKED)
+#includ= e <BaseTsd.h>
+= typedef SSIZE_T ssize_t;
+#define strncasecmp strnicmp
+#define strcasecmp _stricmp
+
+#define S_IRUSR _S_IREAD
+#define S_IWUSR _S_IWRITE
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_OK 0
+#endif
+
#if defined(_MSC_VER) && !defined(__clang__) /* Microso= ft compiler */
#define __func__ __FUNCTION__
#define __attribute__(x)


To view, v= isit cha= nge 1410. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic55e1288b0d3160e68eef07ff4e= dbb070a03dd31
Gerrit-Change-Number: 1410
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --sAVfc9SQbPg=--