Skip to content

Commit

Permalink
fix the SO_REUSEPORT check in configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
djnym committed Feb 12, 2018
1 parent e54ab38 commit 049cbc4
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis-install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ srcdir="$depdir/source"
mkdir -p $srcdir
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$depdir/lib/pkgconfig

LWES_VERSION=1.1.1
LWES_VERSION=1.1.2
MONDEMAND_VERSION=4.4.2

# install lwes
Expand Down
61 changes: 51 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.

AC_INIT([lwes-journaller], [1.1.1], [[email protected]])
AC_INIT([lwes-journaller], [1.1.2], [[email protected]])
AM_INIT_AUTOMAKE([foreign])

dnl Determine the host type for the host specific inclusion below
Expand Down Expand Up @@ -69,7 +69,7 @@ AC_CHECK_HEADER(zlib.h,
AC_SUBST(Z_LIBS)

dnl Check for LWES installed
PKG_CHECK_MODULES([LWES], [lwes-1 >= 1.0.0])
PKG_CHECK_MODULES([LWES], [lwes-1 >= 1.1.2])
AC_SUBST(LWES_CFLAGS)
AC_SUBST(LWES_LIBS)

Expand Down Expand Up @@ -111,14 +111,55 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

dnl Check for SO_REUSEPORT
AC_CHECK_DECL([SO_REUSEPORT],
AC_DEFINE(HAVE_SO_REUSEPORT,1,[Define if kernel supports SO_REUSEPORT]),
,
[
#include <sys/types.h>
#include <sys/socket.h>
])
dnl Found this check here https://github.com/varnish/hitch with license
dnl ------------- BEGIN included chunk
dnl Copyright 2015-2016 Varnish Software
dnl Copyright 2012 Bump Technologies, Inc. All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without modification, are
dnl permitted provided that the following conditions are met:
dnl
dnl 1. Redistributions of source code must retain the above copyright notice, this list of
dnl conditions and the following disclaimer.
dnl
dnl 2. Redistributions in binary form must reproduce the above copyright notice, this list
dnl of conditions and the following disclaimer in the documentation and/or other materials
dnl provided with the distribution.
dnl
dnl THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED
dnl WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
dnl FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR
dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
dnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dnl
dnl The views and conclusions contained in the software and documentation are those of the
dnl authors and should not be interpreted as representing official policies, either expressed
dnl or implied, of Bump Technologies, Inc.
AC_CACHE_CHECK([whether SO_REUSEPORT works],
[ac_cv_so_reuseport_works],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
]], [[
int s = socket(AF_INET, SOCK_STREAM, 0);
int i = 5;
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &i, sizeof i) < 0)
return (1);
return (0);
]])],
[ac_cv_so_reuseport_works=yes],
[ac_cv_so_reuseport_works=no])
]
)
if test "$ac_cv_so_reuseport_works" = yes; then
AC_DEFINE([HAVE_SO_REUSEPORT], [1], [Define if SO_REUSEPORT works])
fi
dnl ------------- END included chunk

dnl Checks for library functions.
AC_FUNC_ALLOCA
Expand Down

0 comments on commit 049cbc4

Please sign in to comment.