diff --git a/configure.ac b/configure.ac index a1d054d4..14653c33 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,19 @@ AC_MSG_RESULT([$os_windows]) AM_CONDITIONAL([OS_WINDOWS], [test "x$os_windows" = "xyes"]) +# ==================== DETECT FREEBSD ==================== +AC_MSG_CHECKING([for FreeBSD]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifndef __FreeBSD__ +#error "Not FreeBSD" +#endif +]], [[ return 0; ]])], + [os_freebsd=yes], + [os_freebsd=no]) +AC_MSG_RESULT([$os_freebsd]) + +AM_CONDITIONAL([OS_FREEBSD], [test "x$os_freebsd" = "xyes"]) + # 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 4c4db743..4a289e94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,9 +27,14 @@ if OS_WINDOWS utun_TUN_SOURCES = tun_windows.c utun_TUN_LIBS = -liphlpapi -lws2_32 -ladvapi32 -lbcrypt -ldbghelp else +if OS_FREEBSD +utun_TUN_SOURCES = tun_freebsd.c +utun_TUN_LIBS = +else utun_TUN_SOURCES = tun_linux.c utun_TUN_LIBS = endif +endif # TinyCrypt sources (only used without OpenSSL) utun_TINYCRYPT_SOURCES = \