From 7dd81d6155f544690df88f74d5bdd4ff51f8e2df Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 8 Mar 2026 19:45:58 +0300 Subject: [PATCH] 1 --- configure.ac | 14 ++++++++++++++ src/Makefile.am | 28 ++-------------------------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 14653c332..278a9a085 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,20 @@ AC_MSG_RESULT([$os_freebsd]) AM_CONDITIONAL([OS_FREEBSD], [test "x$os_freebsd" = "xyes"]) +# Set TUN source file based on platform +if test "x$os_freebsd" = "xyes"; then + TUN_SOURCE="tun_freebsd.c" + TUN_LIBS="" +elif test "x$os_windows" = "xyes"; then + TUN_SOURCE="tun_windows.c" + TUN_LIBS="-liphlpapi -lws2_32 -ladvapi32 -lbcrypt -ldbghelp" +else + TUN_SOURCE="tun_linux.c" + TUN_LIBS="" +fi +AC_SUBST([TUN_SOURCE]) +AC_SUBST([TUN_LIBS]) + # Checks for header files, typedefs, functions... AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h]) AC_TYPE_SIZE_T diff --git a/src/Makefile.am b/src/Makefile.am index 93afbd334..980348001 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,32 +23,8 @@ utun_CORE_SOURCES = \ control_server.c # Platform-specific TUN sources -# Use AM_CONDITIONAL to select the right source file - -if OS_WINDOWS -utun_TUN_SOURCES = tun_windows.c -utun_TUN_LIBS = -liphlpapi -lws2_32 -ladvapi32 -lbcrypt -ldbghelp -AM_CONDITIONAL(TUN_FREEBSD, [false]) -AM_CONDITIONAL(TUN_LINUX, [false]) -endif - -if OS_FREEBSD -utun_TUN_SOURCES = tun_freebsd.c -utun_TUN_LIBS = -AM_CONDITIONAL(TUN_FREEBSD, [true]) -AM_CONDITIONAL(TUN_LINUX, [false]) -endif - -if OS_WINDOWS -else - if OS_FREEBSD - else - utun_TUN_SOURCES = tun_linux.c - utun_TUN_LIBS = - AM_CONDITIONAL(TUN_FREEBSD, [false]) - AM_CONDITIONAL(TUN_LINUX, [true]) - endif -endif +utun_TUN_SOURCES = $(TUN_SOURCE) +utun_TUN_LIBS = $(TUN_LIBS) # TinyCrypt sources (only used without OpenSSL) utun_TINYCRYPT_SOURCES = \