Commit ac2d80b0 authored by Jan Včelák's avatar Jan Včelák 🚀

reuseport: detect as a common dependency

parent c5eda24d
......@@ -174,6 +174,38 @@ AC_ARG_ENABLE([recvmmsg],
[AC_DEFINE(HAVE_RECVMMSG, 1, [Define if struct mmsghdr and recvmmsg() exists.])])
])
AC_ARG_ENABLE([reuseport],
AS_HELP_STRING([--enable-reuseport=auto|yes|no], [enable Linux SO_REUSEPORT support [default=auto]]),
[enable_reuseport="$enableval"], [enable_reuseport=auto])
AC_DEFUN([CHECK_REUSEPORT], [
AC_CHECK_DECL(
[SO_REUSEPORT],
[$1],
[$2],
[
#include <sys/socket.h>
]
)])
AS_IF([test "$enable_reuseport" != no], [
AS_CASE([$enable_reuseport],
[auto],[
AS_CASE([$host_os],
[linux*], [CHECK_REUSEPORT([enable_reuseport=yes], [enable_reuseport=no])],
[*], [enable_reuseport=no]
)],
[yes],[
AS_CASE([$host_os],
[linux*], [CHECK_REUSEPORT([enable_reuseport=yes], [AC_MSG_ERROR([SO_REUSEPORT support not detected.])])],
[*], [AC_MSG_ERROR(["SO_REUSEPORT not supported on $host_os."])]
)],
[*], [AC_MSG_ERROR([Invalid value of --enable-reuseport.])]
)])
AS_IF([test "$enable_reuseport" = yes],[
AC_DEFINE([ENABLE_REUSEPORT], [1], [Use SO_REUSEPORT.])])
# Check for link time optimizations support and predictive commoning
AC_ARG_ENABLE([lto],
AS_HELP_STRING([--enable-lto=yes|no], [enable link-time optimizations, enable if not broken for some extra speed [default=no]]),
......@@ -213,10 +245,6 @@ AC_ARG_ENABLE([systemd],
AS_HELP_STRING([--enable-systemd=auto|yes|no], [enable systemd integration [default=auto]]),
[enable_systemd="$enableval"], [enable_systemd=auto])
AC_ARG_ENABLE([reuseport],
AS_HELP_STRING([--enable-reuseport=auto|yes|no], [enable Linux SO_REUSEPORT support [default=auto]]),
[enable_reuseport="$enableval"], [enable_reuseport=auto])
AS_IF([test "$enable_daemon" = "yes"],[
AS_IF([test "$enable_systemd" != "no"],[
......@@ -231,24 +259,6 @@ AS_IF([test "$enable_systemd" != "no"],[
AS_IF([test "$enable_systemd" = "yes"],[
AC_DEFINE([ENABLE_SYSTEMD], [1], [Use systemd integration.])])
AS_IF([test "$enable_reuseport" != no], [
AS_CASE([$enable_reuseport],
[auto],[
AS_CASE(["$host_os"],
[linux*], [AC_CHECK_DECL([SO_REUSEPORT], [enable_reuseport=yes], [enable_reuseport=no], [#include <sys/socket.h>])],
[*], [enable_reuseport=no]
)],
[yes],[
AS_CASE(["$host_os"],
[linux*], [AC_CHECK_DECL([SO_REUSEPORT], [enable_reuseport=yes], [AC_MSG_ERROR([SO_REUSEPORT is not supported.])], [#include <sys/socket.h>])],
[*], [AC_MSG_ERROR(["SO_REUSEPORT is not supported on $host_os."])]
)],
[*], [AC_MSG_ERROR([Invalid value of --enable-reuseport.])]
)])
AS_IF([test "$enable_reuseport" = yes],[
AC_DEFINE([ENABLE_REUSEPORT], [1], [Use SO_RESUSEPORT.])])
]) dnl enable_daemon
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment