|
Packit |
875988 |
# This file is part of libmicrohttpd.
|
|
Packit |
875988 |
# (C) 2006-2017 Christian Grothoff (and other contributing authors)
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
# libmicrohttpd is free software; you can redistribute it and/or modify
|
|
Packit |
875988 |
# it under the terms of the GNU General Public License as published
|
|
Packit |
875988 |
# by the Free Software Foundation; either version 3, or (at your
|
|
Packit |
875988 |
# option) any later version.
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
# libmicrohttpd is distributed in the hope that it will be useful, but
|
|
Packit |
875988 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
875988 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
875988 |
# General Public License for more details.
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
875988 |
# along with libmicrohttpd; see the file COPYING. If not, write to the
|
|
Packit |
875988 |
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Packit |
875988 |
# Boston, MA 02110-1301, USA.
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
# Process this file with autoconf to produce a configure script.
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
AC_PREREQ([2.64])
|
|
Packit |
875988 |
LT_PREREQ([2.4.0])
|
|
Packit |
875988 |
AC_INIT([GNU Libmicrohttpd],[0.9.59],[libmicrohttpd@gnu.org])
|
|
Packit |
875988 |
AM_INIT_AUTOMAKE([silent-rules] [subdir-objects])
|
|
Packit |
875988 |
AC_CONFIG_HEADERS([MHD_config.h])
|
|
Packit |
875988 |
AC_CONFIG_MACRO_DIR([m4])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
LIB_VERSION_CURRENT=58
|
|
Packit |
875988 |
LIB_VERSION_REVISION=0
|
|
Packit |
875988 |
LIB_VERSION_AGE=46
|
|
Packit |
875988 |
AC_SUBST(LIB_VERSION_CURRENT)
|
|
Packit |
875988 |
AC_SUBST(LIB_VERSION_REVISION)
|
|
Packit |
875988 |
AC_SUBST(LIB_VERSION_AGE)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether z/OS special settings are required]])
|
|
Packit |
875988 |
if test `uname -s` = "OS/390"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
# configure binaries for z/OS
|
|
Packit |
875988 |
if test -z "$CC"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
CC=`pwd`"/contrib/xcc"
|
|
Packit |
875988 |
chmod +x $CC || true
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
if test -z "$CPP"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
CPP="c89 -E"
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
if test -z "$CXXCPP"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
CXXCPP="c++ -E -+"
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
# _CCC_CCMODE=1
|
|
Packit |
875988 |
# _C89_CCMODE=1
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Checks for programs.
|
|
Packit |
875988 |
AC_PROG_AWK
|
|
Packit |
875988 |
AC_PROG_INSTALL
|
|
Packit |
875988 |
AC_PROG_LN_S
|
|
Packit |
875988 |
AC_PROG_MAKE_SET
|
|
Packit |
875988 |
AC_CANONICAL_HOST
|
|
Packit |
875988 |
AC_PROG_CC_STDC
|
|
Packit |
875988 |
MHD_SYS_EXT
|
|
Packit |
875988 |
LT_INIT([win32-dll])
|
|
Packit |
875988 |
LT_LANG([Windows Resource])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Workaround for libgcrypt
|
|
Packit |
875988 |
AS_IF([[test "x$lt_sysroot" != "x" && test "x$SYSROOT" = "x"]], [[SYSROOT="$lt_sysroot"]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
PACKAGE_VERSION_MAJOR='m4_car(m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))'
|
|
Packit |
875988 |
PACKAGE_VERSION_MINOR='m4_argn(2, m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))'
|
|
Packit |
875988 |
PACKAGE_VERSION_SUBMINOR='m4_argn(3, m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))'
|
|
Packit |
875988 |
AS_VAR_ARITH([MHD_W32_DLL_SUFF],[[$LIB_VERSION_CURRENT - $LIB_VERSION_AGE]])
|
|
Packit |
875988 |
AC_SUBST([PACKAGE_VERSION_MAJOR])
|
|
Packit |
875988 |
AC_SUBST([PACKAGE_VERSION_MINOR])
|
|
Packit |
875988 |
AC_SUBST([PACKAGE_VERSION_SUBMINOR])
|
|
Packit |
875988 |
AC_SUBST([MHD_W32_DLL_SUFF])
|
|
Packit |
875988 |
AC_CONFIG_FILES([src/microhttpd/microhttpd_dll_res.rc])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
MHD_LIB_CPPFLAGS=""
|
|
Packit |
875988 |
MHD_LIB_CFLAGS=""
|
|
Packit |
875988 |
MHD_LIB_LDFLAGS=""
|
|
Packit |
875988 |
MHD_LIBDEPS=""
|
|
Packit |
875988 |
# for pkg-config
|
|
Packit |
875988 |
MHD_REQ_PRIVATE=''
|
|
Packit |
875988 |
MHD_LIBDEPS_PKGCFG=''
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AH_TEMPLATE([[HAVE_STDBOOL_H]], [Define to 1 if you have the <stdbool.h> header file and <stdbool.h> defines 'bool' type.])
|
|
Packit |
875988 |
AH_TEMPLATE([[HAVE_REAL_BOOL]], [Define to 1 if you have the real boolean type.])
|
|
Packit |
875988 |
AH_TEMPLATE([[bool]], [Define to type name which will be used as boolean type.])
|
|
Packit |
875988 |
AC_CHECK_HEADER([stdbool.h],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CHECK_TYPE([bool],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_STDBOOL_H]], [[1]])
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_REAL_BOOL]], [[1]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_WARN([[Header <stdbool.h> is present, but "bool" type cannot be detected. Check compiler flags.]])
|
|
Packit |
875988 |
AC_DEFINE([[bool]], [[int]])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
#include <stdbool.h>
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CHECK_TYPE([bool],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_REAL_BOOL]], [[1]])],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CHECK_TYPE([_Bool],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_REAL_BOOL]], [[1]])
|
|
Packit |
875988 |
AC_DEFINE([[bool]], [[_Bool]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([[bool]], [[int]])
|
|
Packit |
875988 |
], []
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
], []
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_INCLUDES_DEFAULT]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether "true" is defined or builtin]], [[mhd_cv_macro_true_defined]],
|
|
Packit |
875988 |
[AC_COMPILE_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_STDBOOL_H
|
|
Packit |
875988 |
#include <stdbool.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
#if defined(true)
|
|
Packit |
875988 |
/* dummy */
|
|
Packit |
875988 |
#else
|
|
Packit |
875988 |
(void)true;
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_macro_true_defined='yes']], [[mhd_cv_macro_true_defined='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_macro_true_defined]], [["yes"]], [[:]],
|
|
Packit |
875988 |
[AC_DEFINE([[true]],[[(!0)]], [Define to value interpreted by compiler as boolean "true", if "true" is not defined by system headers.])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether "false" is defined or builtin]], [[mhd_cv_macro_false_defined]],
|
|
Packit |
875988 |
[AC_COMPILE_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_STDBOOL_H
|
|
Packit |
875988 |
#include <stdbool.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
#if !defined(false)
|
|
Packit |
875988 |
(void)false;
|
|
Packit |
875988 |
#else
|
|
Packit |
875988 |
/* dummy */
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_macro_false_defined='yes']], [[mhd_cv_macro_false_defined='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_macro_false_defined]], [["yes"]], [[:]],
|
|
Packit |
875988 |
[AC_DEFINE([[false]],[[0]], [Define to value interpreted by compiler as boolean "false", if "false" is not defined by system headers.])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether "true" and "false" could be used]], [[mhd_cv_macro_true_false_valid]],
|
|
Packit |
875988 |
[AC_COMPILE_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_STDBOOL_H
|
|
Packit |
875988 |
#include <stdbool.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
int var1[true ? 1 : -1] = { 1 };
|
|
Packit |
875988 |
int var2[false ? -1 : 1] = { 2 };
|
|
Packit |
875988 |
int var3[!true ? -1 : 1] = { 3 };
|
|
Packit |
875988 |
int var4[!false ? 1 : -1] = { 4 };
|
|
Packit |
875988 |
if (var1[0] == var2[0] || var3[0] == var4[0])
|
|
Packit |
875988 |
return 1;
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]],
|
|
Packit |
875988 |
[AC_MSG_ERROR([[Value of "true" or value of "false" is not valid. Check config.log for details.]])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AX_CHECK_COMPILE_FLAG([[-Werror=attributes]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
save_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
CFLAGS="$CFLAGS -Werror=attributes"
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether -Werror=attributes actually works]])
|
|
Packit |
875988 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;}]], [[int r = SimpleFunc(); if (r) return r;]])],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
errattr_CFLAGS=""
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
errattr_CFLAGS="-Werror=attributes"
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
CFLAGS="$save_CFLAGS"
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[[errattr_CFLAGS=""]], [], [])
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for function inline keywords suppoted by $CC]])
|
|
Packit |
875988 |
save_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
CFLAGS="$CFLAGS $errattr_CFLAGS"
|
|
Packit |
875988 |
inln_prfx="none"
|
|
Packit |
875988 |
# Prefer always inline functions
|
|
Packit |
875988 |
for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline; do
|
|
Packit |
875988 |
# Try to link to avoid "symbol undefined" problems at build time
|
|
Packit |
875988 |
AS_IF([[test "x$inln_prfx_chk" = "xInlineWithAttr"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AS_IF([[test "x$errattr_CFLAGS" = "x"]],
|
|
Packit |
875988 |
[[ # Skip test with attribute as negative result can't be detected
|
|
Packit |
875988 |
inln_prfx_chk="__forceinline" # use next value
|
|
Packit |
875988 |
]],[[inln_prfx_chk="inline __attribute__((always_inline))"]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef __cplusplus
|
|
Packit |
875988 |
#error This test is only for C.
|
|
Packit |
875988 |
choke me
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_STDBOOL_H
|
|
Packit |
875988 |
#include <stdbool.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
static $inln_prfx_chk bool cmpfn(int x, int y)
|
|
Packit |
875988 |
{ return x > y; }
|
|
Packit |
875988 |
static $inln_prfx_chk int sumfn(int x, int y)
|
|
Packit |
875988 |
{ return x + y; }
|
|
Packit |
875988 |
]],[[
|
|
Packit |
875988 |
int a = 1, b = 100, c;
|
|
Packit |
875988 |
if (cmpfn(a, b))
|
|
Packit |
875988 |
c = sumfn(a, b);
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
c = 0 - sumfn(a, b);
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[[ inln_prfx="$inln_prfx_chk" ]])
|
|
Packit |
875988 |
test "x$inln_prfx" != "xnone" && break
|
|
Packit |
875988 |
done
|
|
Packit |
875988 |
AS_IF([[test "x$inln_prfx" != "xnone"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([INLINE_FUNC],[1],[Define to 1 if your C compiler supports inline functions.])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED([_MHD_static_inline],[static $inln_prfx],[Define to prefix which will be used with MHD static inline functions.])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AC_DEFINE([_MHD_static_inline],[static],[Define to prefix which will be used with MHD static inline functions.])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$inln_prfx]])
|
|
Packit |
875988 |
CFLAGS="$save_CFLAGS"
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check system type
|
|
Packit |
875988 |
shutdown_trig_select='no'
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for target host OS]])
|
|
Packit |
875988 |
case "$host_os" in
|
|
Packit |
875988 |
*darwin* | *rhapsody* | *macosx*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system])
|
|
Packit |
875988 |
CFLAGS="-no-cpp-precomp -fno-common $CFLAGS"
|
|
Packit |
875988 |
mhd_host_os='Darwin'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
freebsd*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
|
|
Packit |
875988 |
mhd_host_os='FreeBSD'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
openbsd*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
|
|
Packit |
875988 |
mhd_host_os='OpenBSD'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
netbsd*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
|
|
Packit |
875988 |
mhd_host_os='NetBSD'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*solaris*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
|
|
Packit |
875988 |
mhd_host_os='Solaris'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
AC_SEARCH_LIBS(gethostbyname, nsl)
|
|
Packit |
875988 |
AC_SEARCH_LIBS(socket, socket)
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*arm-linux*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
|
|
Packit |
875988 |
mhd_host_os='ARM Linux'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
CFLAGS="-fPIC -pipe $CFLAGS"
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*linux*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
|
|
Packit |
875988 |
mhd_host_os='Linux'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*cygwin*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
|
|
Packit |
875988 |
mhd_host_os='Windows (Cygwin)'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
os_is_windows=yes
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*mingw*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
|
|
Packit |
875988 |
mhd_host_os='Windows (MinGW)'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
LIBS="$LIBS -lws2_32"
|
|
Packit |
875988 |
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool],
|
|
Packit |
875988 |
[[mslibcheck=`lib 2>&1`
|
|
Packit |
875988 |
if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then
|
|
Packit |
875988 |
ac_cv_use_ms_lib_tool=yes
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
ac_cv_use_ms_lib_tool=no
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then
|
|
Packit |
875988 |
AC_SUBST([MS_LIB_TOOL], [[lib]])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
AC_SUBST([lt_cv_objdir])
|
|
Packit |
875988 |
os_is_windows=yes
|
|
Packit |
875988 |
os_is_native_w32=yes
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*openedition*)
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(OS390,1,[This is a OS/390 system])
|
|
Packit |
875988 |
mhd_host_os='OS/390'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
gnu*)
|
|
Packit |
875988 |
AC_DEFINE([[GNU_HURD]], [[1]], [Define to `1' if host machine runs on GNU Hurd.])
|
|
Packit |
875988 |
mhd_host_os='GNU Hurd'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*)
|
|
Packit |
875988 |
mhd_host_os='unrecognised OS'
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_host_os]])
|
|
Packit |
875988 |
AC_MSG_WARN([Unrecognised OS $host_os])
|
|
Packit |
875988 |
AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
esac
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AM_CONDITIONAL([CYGWIN_TARGET], [[test "x$os_is_windows" = "xyes" && \
|
|
Packit |
875988 |
test "x${os_is_native_w32}" != "xyes"]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_ARG_WITH([threads],
|
|
Packit |
875988 |
[AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto) [auto]])],
|
|
Packit |
875988 |
[], [with_threads='auto'])
|
|
Packit |
875988 |
AS_CASE([[$with_threads]],
|
|
Packit |
875988 |
[[win32]], [[with_threads='w32']],
|
|
Packit |
875988 |
[[pthreads]], [[with_threads='posix']],
|
|
Packit |
875988 |
[[posix]], [[:]],
|
|
Packit |
875988 |
[[w32]], [[:]],
|
|
Packit |
875988 |
[[auto]], [[:]],
|
|
Packit |
875988 |
[AC_MSG_ERROR([[incorrect parameter "$with_threads" specified for --with-threads]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check for posix threads support, regardless of configure parameters as
|
|
Packit |
875988 |
# testsuite use only posix threads.
|
|
Packit |
875988 |
AX_PTHREAD(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
mhd_have_posix_threads='yes'
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_PTHREAD_H]],[[1]],[Define to 1 if you have the <pthread.h> header file.])
|
|
Packit |
875988 |
],[[mhd_have_posix_threads='no']])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_POSIX_THREADS],[test "x$mhd_have_posix_threads" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
mhd_have_w32_threads='no'
|
|
Packit |
875988 |
AS_IF([[test "x$with_threads" = "xauto"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AS_IF([[test "x$os_is_windows" = "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for W32 threads]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <windows.h>
|
|
Packit |
875988 |
]], [ HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL);])]
|
|
Packit |
875988 |
, [[mhd_have_w32_threads='yes']], [[mhd_have_w32_threads='no']]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AC_MSG_RESULT([[$mhd_have_w32_threads]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for threading lib to use with libmicrohttpd]])
|
|
Packit |
875988 |
AS_IF([[test "x$with_threads" = "xposix"]],
|
|
Packit |
875988 |
[ # forced posix threads
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_have_posix_threads" = "xyes"]], [[ USE_THREADS='posix' ]],
|
|
Packit |
875988 |
[ AS_IF([[test "x$os_is_windows" = "xyes"]] ,
|
|
Packit |
875988 |
[ AC_MSG_ERROR([[Posix threads are not available. Try to configure --with-threads=auto]])],
|
|
Packit |
875988 |
[ AC_MSG_ERROR([[No threading lib is available. Consider installing pthreads]])] )
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
] ,
|
|
Packit |
875988 |
[[ test "x$with_threads" = "xw32" ]] ,
|
|
Packit |
875988 |
[ # forced w32 threads
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_have_w32_threads" = "xyes"]],
|
|
Packit |
875988 |
[[ USE_THREADS='w32' ]],
|
|
Packit |
875988 |
[ AC_MSG_ERROR([[W32 threads are not available. Try to configure --with-threads=auto]])])
|
|
Packit |
875988 |
] ,
|
|
Packit |
875988 |
[ # automatic threads lib selection
|
|
Packit |
875988 |
AS_IF([[test "x$os_is_native_w32" = "xyes" && test "x$mhd_have_w32_threads" = "xyes"]] ,
|
|
Packit |
875988 |
[[ USE_THREADS='w32' ]] ,
|
|
Packit |
875988 |
[[ test "x$mhd_have_posix_threads" = "xyes" ]], [[ USE_THREADS='posix' ]],
|
|
Packit |
875988 |
[[ test "x$mhd_have_w32_threads" = "xyes" ]], [[ USE_THREADS='w32' ]],
|
|
Packit |
875988 |
[ AC_MSG_ERROR([[No threading lib is available. Consider installing pthreads]]) ]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
if test "x$USE_THREADS" = "xposix"; then
|
|
Packit |
875988 |
CC="$PTHREAD_CC"
|
|
Packit |
875988 |
AC_DEFINE([MHD_USE_POSIX_THREADS],[1],[define to use pthreads])
|
|
Packit |
875988 |
MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS"
|
|
Packit |
875988 |
MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS"
|
|
Packit |
875988 |
MHD_LIBDEPS_PKGCFG="$PTHREAD_LIBS $MHD_LIBDEPS_PKGCFG"
|
|
Packit |
875988 |
elif test "x$USE_THREADS" = "xw32"; then
|
|
Packit |
875988 |
AC_DEFINE([MHD_USE_W32_THREADS],[1],[define to use W32 threads])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"])
|
|
Packit |
875988 |
AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$USE_THREADS]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_ARG_ENABLE([[thread-names]],
|
|
Packit |
875988 |
[AS_HELP_STRING([--disable-thread-names [auto] ],[do not set names on MHD generated threads])],
|
|
Packit |
875988 |
[], [enable_thread_names='auto'])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then
|
|
Packit |
875988 |
# Check for thread name function
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="no"
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
SAVE_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
LIBS="$PTHREAD_LIBS $LIBS"
|
|
Packit |
875988 |
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|
Packit |
875988 |
AC_CHECK_HEADERS([pthread_np.h],[],[],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_INCLUDES_DEFAULT
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Try to find how to set thread name by thread attributes.
|
|
Packit |
875988 |
# If pthread_attr_setname_np(3) is not declared, it's not possible to detect
|
|
Packit |
875988 |
# form of pthread_attr_setname_np(3) due to C "feature" "implicit declaration".
|
|
Packit |
875988 |
AC_CHECK_DECL([[pthread_attr_setname_np]],[],[],[[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]],
|
|
Packit |
875988 |
[AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in NetBSD or OSF1 form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
pthread_attr_t thr_attr;
|
|
Packit |
875988 |
pthread_attr_init(&thr_attr);
|
|
Packit |
875988 |
pthread_attr_setname_np(&thr_attr, "name", 0);
|
|
Packit |
875988 |
pthread_attr_destroy(&thr_attr);
|
|
Packit |
875988 |
]])],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_attr_setname_np(3) function.])
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]],
|
|
Packit |
875988 |
[AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in IBM i form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
pthread_attr_t thr_attr;
|
|
Packit |
875988 |
pthread_attr_init(&thr_attr);
|
|
Packit |
875988 |
pthread_attr_setname_np(&thr_attr, "name");
|
|
Packit |
875988 |
pthread_attr_destroy(&thr_attr);
|
|
Packit |
875988 |
]])],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI]], [[1]], [Define if you have IBM i form of pthread_attr_setname_np(3) function.])
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Try to find how to set thread name for started thread - less convinent
|
|
Packit |
875988 |
# than setting name by attributes.
|
|
Packit |
875988 |
# If pthread_setname_np(3) is not declared, it's not possible to detect
|
|
Packit |
875988 |
# form of pthread_setname_np(3) due to C "feature" "implicit declaration".
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]],
|
|
Packit |
875988 |
[AC_CHECK_DECL([[pthread_setname_np]],[],[],[[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]],
|
|
Packit |
875988 |
[AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[int res = pthread_setname_np(pthread_self(), "name", 0);]])],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) function.])
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]],
|
|
Packit |
875988 |
[AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[int res = pthread_setname_np(pthread_self(), "name");]])],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_GNU]], [[1]], [Define if you have GNU/Linux form of pthread_setname_np(3) function.])
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]],
|
|
Packit |
875988 |
[AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[int res = pthread_setname_np("name");]])],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if you have Darwin form of pthread_setname_np(3) function.])
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CHECK_DECL([[pthread_set_name_np]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for pthread_set_name_np(3) in FreeBSD form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[pthread_set_name_np(pthread_self(), "name");]])],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define if you have FreeBSD form of pthread_set_name_np(3) function.])
|
|
Packit |
875988 |
HAVE_THREAD_NAME_FUNC="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],[],[[
|
|
Packit |
875988 |
#include <pthread.h>
|
|
Packit |
875988 |
#ifdef HAVE_PTHREAD_NP_H
|
|
Packit |
875988 |
#include <pthread_np.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
CFLAGS="$SAVE_CFLAGS"
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF(
|
|
Packit |
875988 |
[[test "x$enable_thread_names" != "xno"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to enable thread names]])
|
|
Packit |
875988 |
AC_COMPILE_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM([], [[
|
|
Packit |
875988 |
#ifdef MHD_NO_THREAD_NAMES
|
|
Packit |
875988 |
#error Thread names are disabled.
|
|
Packit |
875988 |
choke me
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
/* Keep in sync with mhd_threads.h */
|
|
Packit |
875988 |
#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) || \
|
|
Packit |
875988 |
defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || \
|
|
Packit |
875988 |
defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) )
|
|
Packit |
875988 |
int a = 1;
|
|
Packit |
875988 |
#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER)
|
|
Packit |
875988 |
int b = 2;
|
|
Packit |
875988 |
#else
|
|
Packit |
875988 |
#error No thread name function is available.
|
|
Packit |
875988 |
choke me
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
enable_thread_names='yes'
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AS_IF([[test "x$enable_thread_names" = "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
AC_MSG_ERROR([[thread names was explicitly requested, but thread name function is not available]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
enable_thread_names='no'
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_thread_names]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$enable_thread_names" = "xno"]],
|
|
Packit |
875988 |
[AC_DEFINE([[MHD_NO_THREAD_NAMES]], [[1]], [Define to 1 to disable setting name on generated threads])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"])
|
|
Packit |
875988 |
w32_shared_lib_exp=no
|
|
Packit |
875988 |
if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then
|
|
Packit |
875988 |
if test "x$ac_cv_use_ms_lib_tool" = "xyes" || test -n "$DLLTOOL"; then
|
|
Packit |
875988 |
w32_shared_lib_exp=yes
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
AC_MSG_WARN([[GNU dlltool or MS lib.exe is required for creating shared library export on W32]])
|
|
Packit |
875988 |
AC_MSG_WARN([[Export library libmicrohttpd.lib will not be created]])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
AM_CONDITIONAL(W32_SHARED_LIB_EXP, [test "x$w32_shared_lib_exp" = "xyes"])
|
|
Packit |
875988 |
AM_CONDITIONAL(USE_MS_LIB_TOOL, [test "x$ac_cv_use_ms_lib_tool" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([AC_DEFINE([HAVE_LISTEN_SHUTDOWN],[1],[can use shutdown on listen sockets])])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_LISTEN_SHUTDOWN], [test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# set GCC options
|
|
Packit |
875988 |
# use '-fno-strict-aliasing', but only if the compiler
|
|
Packit |
875988 |
# and linker can take it
|
|
Packit |
875988 |
AX_CHECK_LINK_FLAG([-fno-strict-aliasing],
|
|
Packit |
875988 |
[AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_C_BIGENDIAN
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_PROG([HAVE_CURL_BINARY],[curl],[yes],[no])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_CURL_BINARY],[test "x$HAVE_CURL_BINARY" = "xyes"])
|
|
Packit |
875988 |
AC_CHECK_PROG([HAVE_MAKEINFO_BINARY],[makeinfo],[yes],[no])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_MAKEINFO_BINARY],[test "x$HAVE_MAKEINFO_BINARY" = "xyes"])
|
|
Packit |
875988 |
AM_CONDITIONAL(W32_STATIC_LIB, [test "x$os_is_native_w32" = "xyes" && test "x$enable_static" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_ARG_ENABLE([[doc]],
|
|
Packit |
875988 |
[AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], ,
|
|
Packit |
875988 |
[enable_doc=yes])
|
|
Packit |
875988 |
test "x$enable_doc" = "xno" || enable_doc=yes
|
|
Packit |
875988 |
AM_CONDITIONAL([BUILD_DOC], [test "x$enable_doc" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_ARG_ENABLE([[examples]],
|
|
Packit |
875988 |
[AS_HELP_STRING([[--disable-examples]], [do not build any examples])], ,
|
|
Packit |
875988 |
[enable_examples=yes])
|
|
Packit |
875988 |
test "x$enable_examples" = "xno" || enable_examples=yes
|
|
Packit |
875988 |
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$enable_examples" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_ARG_ENABLE([[poll]],
|
|
Packit |
875988 |
[AS_HELP_STRING([[--enable-poll[=ARG]]], [enable poll support (yes, no, auto) [auto]])],
|
|
Packit |
875988 |
[enable_poll=${enableval}],
|
|
Packit |
875988 |
[enable_poll='auto']
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if test "$enable_poll" != "no"; then
|
|
Packit |
875988 |
if test "$os_is_native_w32" != "yes"; then
|
|
Packit |
875988 |
AC_CHECK_HEADERS([poll.h],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CHECK_FUNCS([poll], [have_poll='yes'], [have_poll='no'])
|
|
Packit |
875988 |
], [], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
AC_MSG_CHECKING([for WSAPoll()])
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <winsock2.h>
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
WSAPOLLFD fda[2];
|
|
Packit |
875988 |
WSAPoll(fda, 2, 0);]])],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
have_poll='yes'
|
|
Packit |
875988 |
AC_DEFINE([HAVE_POLL],[1])
|
|
Packit |
875988 |
], [have_poll='no'])
|
|
Packit |
875988 |
AC_MSG_RESULT([$have_poll])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
if test "$enable_poll" = "yes" && test "$have_poll" != "yes"; then
|
|
Packit |
875988 |
AC_MSG_ERROR([[Support for poll was explicitly requested but cannot be enabled on this platform.]])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
enable_poll="$have_poll"
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_ARG_ENABLE([[epoll]],
|
|
Packit |
875988 |
[AS_HELP_STRING([[--enable-epoll[=ARG]]], [enable epoll support (yes, no, auto) [auto]])],
|
|
Packit |
875988 |
[enable_epoll=${enableval}],
|
|
Packit |
875988 |
[enable_epoll='auto']
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if test "$enable_epoll" != "no"; then
|
|
Packit |
875988 |
AX_HAVE_EPOLL
|
|
Packit |
875988 |
if test "${ax_cv_have_epoll}" = "yes"; then
|
|
Packit |
875988 |
AC_DEFINE([[EPOLL_SUPPORT]],[[1]],[Define to 1 to enable epoll support])
|
|
Packit |
875988 |
enable_epoll='yes'
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
if test "$enable_epoll" = "yes"; then
|
|
Packit |
875988 |
AC_MSG_ERROR([[Support for epoll was explicitly requested but cannot be enabled on this platform.]])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
enable_epoll='no'
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if test "x$enable_epoll" = "xyes"; then
|
|
Packit |
875988 |
AC_CACHE_CHECK([for epoll_create1()], [mhd_cv_have_epoll_create1], [
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <sys/epoll.h>
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
int fd;
|
|
Packit |
875988 |
fd = epoll_create1(EPOLL_CLOEXEC);]])],
|
|
Packit |
875988 |
[mhd_cv_have_epoll_create1=yes],
|
|
Packit |
875988 |
[mhd_cv_have_epoll_create1=no])])
|
|
Packit |
875988 |
AS_IF([test "x$mhd_cv_have_epoll_create1" = "xyes"],[
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 function.])])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check for headers that are ALWAYS required
|
|
Packit |
875988 |
AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h], [], [AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check for optional headers
|
|
Packit |
875988 |
AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h \
|
|
Packit |
875988 |
sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \
|
|
Packit |
875988 |
endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \
|
|
Packit |
875988 |
inttypes.h stddef.h unistd.h \
|
|
Packit |
875988 |
sockLib.h inetLib.h net/if.h], [], [], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_HEADER([[search.h]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
gl_FUNC_TSEARCH
|
|
Packit |
875988 |
AS_IF([[test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_SEARCH_H]], [[1]],
|
|
Packit |
875988 |
[Define to 1 if you have the <search.h> header file and your system have properly functioning tsearch(), tfind() and tdelete() functions])])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AM_CONDITIONAL([MHD_HAVE_TSEARCH], [[test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check for generic functions
|
|
Packit |
875988 |
AC_CHECK_FUNCS([rand random])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
|
|
Packit |
875988 |
[ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
#ifdef HAVE_SYS_TYPES_H
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_SYS_SOCKET_H
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_NETINET_IN_H
|
|
Packit |
875988 |
#include <netinet/in.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_DECLS([getsockname],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CHECK_FUNCS([getsockname],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether getsockname() is usable]], [[mhc_cv_getsockname_usable]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_RUN_IFELSE(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LANG_SOURCE(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_SYS_TYPES_H
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_SYS_SOCKET_H
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_WINSOCK2_H
|
|
Packit |
875988 |
#include <winsock2.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_WS2TCPIP_H
|
|
Packit |
875988 |
#include <ws2tcpip.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_NETINET_IN_H
|
|
Packit |
875988 |
#include <netinet/in.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_NETINET_IP_H
|
|
Packit |
875988 |
#include <netinet/ip.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_ARPA_INET_H
|
|
Packit |
875988 |
#include <arpa/inet.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
static void zr_mem(void *ptr, socklen_t size)
|
|
Packit |
875988 |
{ char *mem = ptr; while(size--) {mem[0] = 0; mem++;} }
|
|
Packit |
875988 |
|
|
Packit |
875988 |
int main(void)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
const socklen_t c_addr_size = (socklen_t)sizeof(struct sockaddr_in);
|
|
Packit |
875988 |
struct sockaddr_in sa;
|
|
Packit |
875988 |
socklen_t addr_size;
|
|
Packit |
875988 |
int ret = 1;
|
|
Packit |
875988 |
#if !defined(_WIN32) || defined(__CYGWIN__)
|
|
Packit |
875988 |
int sckt;
|
|
Packit |
875988 |
const int invld_sckt = -1;
|
|
Packit |
875988 |
#else
|
|
Packit |
875988 |
SOCKET sckt;
|
|
Packit |
875988 |
const SOCKET invld_sckt = INVALID_SOCKET;
|
|
Packit |
875988 |
WSADATA wsa_data;
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion)
|
|
Packit |
875988 |
return 20;
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
sckt = socket (PF_INET, SOCK_STREAM, 0);
|
|
Packit |
875988 |
if (invld_sckt != sckt)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
zr_mem(&sa, c_addr_size);
|
|
Packit |
875988 |
sa.sin_family = AF_INET;
|
|
Packit |
875988 |
#if HAVE_SOCKADDR_IN_SIN_LEN
|
|
Packit |
875988 |
sa.sin_len = c_addr_size;
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
if (0 == bind (sckt, (struct sockaddr *)&sa, c_addr_size))
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
if (0 == listen (sckt, 1))
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
addr_size = c_addr_size;
|
|
Packit |
875988 |
if (0 == getsockname (sckt, (struct sockaddr *)&sa, &addr_size))
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
if (c_addr_size >= addr_size)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
if (0 != ntohs(sa.sin_port))
|
|
Packit |
875988 |
{ ret = 0;
|
|
Packit |
875988 |
} else ret = 7;
|
|
Packit |
875988 |
} else ret = 6;
|
|
Packit |
875988 |
} else ret = 5;
|
|
Packit |
875988 |
} else ret = 4;
|
|
Packit |
875988 |
} else ret = 3;
|
|
Packit |
875988 |
} else ret = 2;
|
|
Packit |
875988 |
#if !defined(_WIN32) || defined(__CYGWIN__)
|
|
Packit |
875988 |
close (sckt);
|
|
Packit |
875988 |
#else
|
|
Packit |
875988 |
closesocket (sckt);
|
|
Packit |
875988 |
WSACleanup();
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
return ret;
|
|
Packit |
875988 |
}
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[[mhc_cv_getsockname_usable='yes']],
|
|
Packit |
875988 |
[[mhc_cv_getsockname_usable='no']],
|
|
Packit |
875988 |
[[mhc_cv_getsockname_usable='assuming yes']]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[mhc_cv_getsockname_usable]], [["no"]], [:],
|
|
Packit |
875988 |
[AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
], [],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_SYS_TYPES_H
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_SYS_SOCKET_H
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_WINSOCK2_H
|
|
Packit |
875988 |
#include <winsock2.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check for inter-thread signaling type
|
|
Packit |
875988 |
AC_ARG_ENABLE([[itc]],
|
|
Packit |
875988 |
[AS_HELP_STRING([[--enable-itc=TYPE]], [use TYPE of inter-thread communication (pipe, socketpair, eventfd) [auto]])], [],
|
|
Packit |
875988 |
[[enable_itc='auto']]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_CASE([[$enable_itc]],
|
|
Packit |
875988 |
[[pipe]], [[:]],
|
|
Packit |
875988 |
[[socketpair]], [[:]],
|
|
Packit |
875988 |
[[eventfd]], [[:]],
|
|
Packit |
875988 |
[[auto]], [AS_VAR_IF([[os_is_windows]], [["yes"]], [[enable_itc='socketpair']])],
|
|
Packit |
875988 |
[[eventFD]], [[enable_itc='eventfd']],
|
|
Packit |
875988 |
[[socket]], [[enable_itc='socketpair']],
|
|
Packit |
875988 |
[[no]], [AC_MSG_ERROR([[inter-thread communication cannot be disabled]])],
|
|
Packit |
875988 |
[AC_MSG_ERROR([[unrecognized type "$enable_itc" of inter-thread communication specified by "--enable-itc=$enable_itc"]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
# AS_UNSET([[use_itc]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [
|
|
Packit |
875988 |
AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [
|
|
Packit |
875988 |
AC_CHECK_HEADERS([sys/eventfd.h], [], [], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
AS_VAR_IF([[ac_cv_header_sys_eventfd_h]], [["yes"]], [
|
|
Packit |
875988 |
AC_CACHE_CHECK([whether eventfd(2) is usable], [[mhd_cv_eventfd_usable]], [
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <sys/eventfd.h>
|
|
Packit |
875988 |
]], [[int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_eventfd_usable]], [["yes"]], [
|
|
Packit |
875988 |
use_itc='eventfd'
|
|
Packit |
875988 |
enable_itc="$use_itc"
|
|
Packit |
875988 |
AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [
|
|
Packit |
875988 |
AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether pipe(3) is usable]], [[mhd_cv_pipe_usable]], [
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([
|
|
Packit |
875988 |
AC_INCLUDES_DEFAULT
|
|
Packit |
875988 |
#ifdef HAVE_UNISTD_H
|
|
Packit |
875988 |
#include <unistd.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
], [[
|
|
Packit |
875988 |
int arr[2];
|
|
Packit |
875988 |
int res;
|
|
Packit |
875988 |
res = pipe(arr)
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [
|
|
Packit |
875988 |
use_itc='pipe'
|
|
Packit |
875988 |
enable_itc="$use_itc"
|
|
Packit |
875988 |
AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication])
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([
|
|
Packit |
875988 |
AC_INCLUDES_DEFAULT
|
|
Packit |
875988 |
#ifdef HAVE_FCNTL_H
|
|
Packit |
875988 |
#include <fcntl.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_UNISTD_H
|
|
Packit |
875988 |
#include <unistd.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
], [[
|
|
Packit |
875988 |
int arr[2];
|
|
Packit |
875988 |
int res;
|
|
Packit |
875988 |
res = pipe2(arr, O_CLOEXEC | O_NONBLOCK)
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$enable_itc" = "xsocketpair" || test "x$enable_itc" = "xauto"]], [
|
|
Packit |
875988 |
AS_VAR_IF([[os_is_native_w32]], [["yes"]], [[mhd_cv_socketpair_usable='yes']], [
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether socketpair(3) is usable]], [[mhd_cv_socketpair_usable]], [
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([
|
|
Packit |
875988 |
AC_INCLUDES_DEFAULT
|
|
Packit |
875988 |
#ifdef HAVE_SYS_TYPES_H
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_SYS_SOCKET_H
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
], [[
|
|
Packit |
875988 |
int arr[2];
|
|
Packit |
875988 |
int res;
|
|
Packit |
875988 |
#if defined(AF_LOCAL)
|
|
Packit |
875988 |
res = socketpair(AF_LOCAL, SOCK_STREAM, 0, arr);
|
|
Packit |
875988 |
#elif defined(AF_UNIX)
|
|
Packit |
875988 |
res = socketpair(AF_UNIX, SOCK_STREAM, 0, arr);
|
|
Packit |
875988 |
#else
|
|
Packit |
875988 |
#error AF_LOCAL and AF_UNIX are both undefined
|
|
Packit |
875988 |
choke me now;
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
if (res != 0) return 1
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [[mhd_cv_socketpair_usable='yes']], [[mhd_cv_socketpair_usable='no']])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_socketpair_usable]], [["yes"]], [
|
|
Packit |
875988 |
use_itc='socketpair'
|
|
Packit |
875988 |
enable_itc="$use_itc"
|
|
Packit |
875988 |
AC_DEFINE([[_MHD_ITC_SOCKETPAIR]], [[1]], [Define to use socketpair for inter-thread communication])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AS_VAR_IF([[enable_itc]], [["socketpair"]], [AC_MSG_ERROR([[socketpair(3) is not usable, consider using other type of inter-thread communication]])])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test -z "$use_itc"]], [AC_MSG_ERROR([[cannot find useable type of inter-thread communication]])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_FUNCS_ONCE([accept4 gmtime_r memmem snprintf])
|
|
Packit |
875988 |
AC_CHECK_DECL([gmtime_s],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether gmtime_s is in C11 form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[ AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#define __STDC_WANT_LIB_EXT1__ 1
|
|
Packit |
875988 |
#include <time.h>
|
|
Packit |
875988 |
#ifdef __cplusplus
|
|
Packit |
875988 |
extern "C"
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
struct tm* gmtime_s(const time_t* time, struct tm* result);
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
struct tm res;
|
|
Packit |
875988 |
time_t t;
|
|
Packit |
875988 |
gmtime_s (&t, &res;;
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_C11_GMTIME_S], [1], [Define to 1 if you have the `gmtime_s' function in C11 form.])
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether gmtime_s is in W32 form]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[ AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <time.h>
|
|
Packit |
875988 |
#ifdef __cplusplus
|
|
Packit |
875988 |
extern "C"
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
errno_t gmtime_s(struct tm* _tm, const time_t* time);
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
struct tm res;
|
|
Packit |
875988 |
time_t t;
|
|
Packit |
875988 |
gmtime_s (&res, &t);
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_W32_GMTIME_S], [1], [Define to 1 if you have the `gmtime_s' function in W32 form.])
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
], [],
|
|
Packit |
875988 |
[[#define __STDC_WANT_LIB_EXT1__ 1
|
|
Packit |
875988 |
#include <time.h>]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_DECLS([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONBLOCK is defined in a socket header])], [],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
#if defined(HAVE_SYS_TYPES_H)
|
|
Packit |
875988 |
# include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if defined(HAVE_SYS_SOCKET_H)
|
|
Packit |
875988 |
# include <sys/socket.h>
|
|
Packit |
875988 |
#elif defined(HAVE_WINSOCK2_H)
|
|
Packit |
875988 |
# include <winsock2.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CHECK_DECL([[clock_gettime]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
AC_SEARCH_LIBS([clock_gettime], [rt],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])
|
|
Packit |
875988 |
AS_VAR_IF([[ac_cv_search_clock_gettime]],[["none required"]], [],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS"
|
|
Packit |
875988 |
MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG"
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
], [], [$MHD_LIBDEPS])
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
], [], [[
|
|
Packit |
875988 |
#include <time.h>
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for clock_get_time]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <mach/clock.h>
|
|
Packit |
875988 |
#include <mach/mach.h>
|
|
Packit |
875988 |
]],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
clock_serv_t cs;
|
|
Packit |
875988 |
mach_timespec_t mt;
|
|
Packit |
875988 |
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cs);
|
|
Packit |
875988 |
clock_get_time(cs, &mt;;
|
|
Packit |
875988 |
mach_port_deallocate(mach_task_self(), cs);
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_CLOCK_GET_TIME], [1], [Define to 1 if you have `clock_get_time', `host_get_clock_service' and `mach_port_deallocate' functions.])
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for gethrtime]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_SYS_TIME_H
|
|
Packit |
875988 |
/* Solaris define gethrtime() in sys/time.h */
|
|
Packit |
875988 |
#include <sys/time.h>
|
|
Packit |
875988 |
#endif /* HAVE_SYS_TIME_H */
|
|
Packit |
875988 |
#ifdef HAVE_TIME_H
|
|
Packit |
875988 |
/* HP-UX define gethrtime() in time.h */
|
|
Packit |
875988 |
#include <time.h>
|
|
Packit |
875988 |
#endif /* HAVE_TIME_H */
|
|
Packit |
875988 |
]], [[hrtime_t hrt = gethrtime(); ]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_GETHRTIME], [1], [Define to 1 if you have `gethrtime' function.])
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# IPv6
|
|
Packit |
875988 |
AC_MSG_CHECKING(for IPv6)
|
|
Packit |
875988 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <stdio.h>
|
|
Packit |
875988 |
#if HAVE_NETINET_IN_H
|
|
Packit |
875988 |
#include <netinet/in.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_SOCKET_H
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_WINSOCK2_H
|
|
Packit |
875988 |
#include <winsock2.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_WS2TCPIP_H
|
|
Packit |
875988 |
#include <ws2tcpip.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
int af=AF_INET6;
|
|
Packit |
875988 |
int pf=PF_INET6;
|
|
Packit |
875988 |
struct sockaddr_in6 sa;
|
|
Packit |
875988 |
printf("%d %d %p\n", af, pf, &sa);
|
|
Packit |
875988 |
]])],[
|
|
Packit |
875988 |
have_inet6=yes;
|
|
Packit |
875988 |
AC_DEFINE([HAVE_INET6], [1], [Provides IPv6 headers])
|
|
Packit |
875988 |
],[
|
|
Packit |
875988 |
have_inet6=no
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
AC_MSG_RESULT($have_inet6)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
HIDDEN_VISIBILITY_CFLAGS=""
|
|
Packit |
875988 |
case "$host" in
|
|
Packit |
875988 |
*-*-mingw*)
|
|
Packit |
875988 |
dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
|
|
Packit |
875988 |
AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
|
|
Packit |
875988 |
[defines how to decorate public symbols while building])
|
|
Packit |
875988 |
HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*)
|
|
Packit |
875988 |
dnl on other compilers, check if we can do -fvisibility=hidden
|
|
Packit |
875988 |
AX_CHECK_LINK_FLAG([-fvisibility=hidden],
|
|
Packit |
875988 |
[AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
|
|
Packit |
875988 |
[AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) extern],
|
|
Packit |
875988 |
[defines how to decorate public symbols while building])
|
|
Packit |
875988 |
HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"])])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
esac
|
|
Packit |
875988 |
AC_SUBST(HIDDEN_VISIBILITY_CFLAGS)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# libcurl (required for testing)
|
|
Packit |
875988 |
AC_ARG_ENABLE([curl],
|
|
Packit |
875988 |
[AS_HELP_STRING([--disable-curl],[disable cURL based testcases])],
|
|
Packit |
875988 |
[enable_curl=${enableval}])
|
|
Packit |
875988 |
curl=0
|
|
Packit |
875988 |
if test "$enable_curl" != "no"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
LIBCURL_CHECK_CONFIG([yes],[7.16.4],[enable_curl=yes],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
if test "x$enable_curl" = "xyes"; then
|
|
Packit |
875988 |
AC_MSG_WARN([[cURL-based tests cannot be enabled because libcurl is missing]])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
enable_curl=no
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
if test "$enable_curl" != "no"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
# Lib cURL & cURL - OpenSSL versions
|
|
Packit |
875988 |
AC_DEFINE([MHD_REQ_CURL_VERSION], ["7.16.4"], [required cURL version to run tests])
|
|
Packit |
875988 |
AC_DEFINE([MHD_REQ_CURL_OPENSSL_VERSION], ["0.9.8"], [required cURL SSL version to run tests])
|
|
Packit |
875988 |
AC_DEFINE([MHD_REQ_CURL_GNUTLS_VERSION], ["2.8.6"], [gnuTLS lib version - used in conjunction with cURL])
|
|
Packit |
875988 |
AC_DEFINE([MHD_REQ_CURL_NSS_VERSION], ["3.12.0"], [NSS lib version - used in conjunction with cURL])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_CURL], [test "x$enable_curl" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
mhd_have_libmagic="no"
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
LIBS="$LIBS -lmagic"
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for suitable libmagic]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <magic.h>
|
|
Packit |
875988 |
]],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
char var_data[256];
|
|
Packit |
875988 |
const char *var_mime;
|
|
Packit |
875988 |
magic_t var_magic = magic_open (MAGIC_MIME_TYPE);
|
|
Packit |
875988 |
(void)magic_load (var_magic, NULL);
|
|
Packit |
875988 |
var_data[0] = 0;
|
|
Packit |
875988 |
var_mime = magic_buffer (var_magic, var_data, 1);
|
|
Packit |
875988 |
magic_close (var_magic);
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_LIBMAGIC], [1], [Define to 1 if you have suitable libmagic.])
|
|
Packit |
875988 |
mhd_have_libmagic="yes"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_LIBMAGIC], [[test "x$mhd_have_libmagic" = "xyes"]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# large file support (> 4 GB)
|
|
Packit |
875988 |
AC_SYS_LARGEFILE
|
|
Packit |
875988 |
AC_FUNC_FSEEKO
|
|
Packit |
875988 |
AC_CHECK_FUNCS([lseek64 pread64 pread])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# check for various sendfile functions
|
|
Packit |
875988 |
AC_ARG_ENABLE([sendfile],
|
|
Packit |
875988 |
[AS_HELP_STRING([--disable-sendfile],
|
|
Packit |
875988 |
[disable usage of sendfile() for HTTP connections [auto]])],
|
|
Packit |
875988 |
[],
|
|
Packit |
875988 |
[enable_sendfile="auto"])
|
|
Packit |
875988 |
AS_CASE([$enable_sendfile],
|
|
Packit |
875988 |
[[auto | yes]],[[found_sendfile="no"]],
|
|
Packit |
875988 |
[[no]],[[found_sendfile="disabled"]],
|
|
Packit |
875988 |
[AC_MSG_ERROR([[unknown value specified: --enable-sendfile=$enable_sendfile]])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[found_sendfile]], [["no"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for Linux-style sendfile(2)]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <sys/sendfile.h>
|
|
Packit |
875988 |
|
|
Packit |
875988 |
static void empty_func(void)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
/* Check for declaration */
|
|
Packit |
875988 |
(void)sendfile;
|
|
Packit |
875988 |
}
|
|
Packit |
875988 |
/* Declare again to check form match */
|
|
Packit |
875988 |
ssize_t sendfile(int, int, off_t*, size_t);
|
|
Packit |
875988 |
]],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
int fd1=0, fd2=2;
|
|
Packit |
875988 |
off_t o = 0;
|
|
Packit |
875988 |
size_t s = 5;
|
|
Packit |
875988 |
ssize_t r;
|
|
Packit |
875988 |
r = sendfile (fd1, fd2, &o, s);
|
|
Packit |
875988 |
if (r)
|
|
Packit |
875988 |
empty_func();
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_LINUX_SENDFILE], [1], [Define to 1 if you have linux-style sendfile(2).])
|
|
Packit |
875988 |
found_sendfile="yes, Linux-style"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
AC_CHECK_FUNCS([sendfile64])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[found_sendfile]], [["no"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for FreeBSD-style sendfile(2)]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#include <sys/uio.h>
|
|
Packit |
875988 |
|
|
Packit |
875988 |
static void empty_func(void)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
/* Check for declaration */
|
|
Packit |
875988 |
(void)sendfile;
|
|
Packit |
875988 |
}
|
|
Packit |
875988 |
/* Declare again to check form match */
|
|
Packit |
875988 |
int sendfile(int, int, off_t, size_t,
|
|
Packit |
875988 |
struct sf_hdtr*, off_t*, int);
|
|
Packit |
875988 |
]],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
int fd1=0, fd2=1;
|
|
Packit |
875988 |
off_t o = 0;
|
|
Packit |
875988 |
size_t s = 5;
|
|
Packit |
875988 |
off_t r1;
|
|
Packit |
875988 |
int r2;
|
|
Packit |
875988 |
r2 = sendfile (fd1, fd2, o, s, (void*)0, &r1, 0);
|
|
Packit |
875988 |
if (r2)
|
|
Packit |
875988 |
empty_func();
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_FREEBSD_SENDFILE], [1], [Define to 1 if you have FreeBSD-style sendfile(2).])
|
|
Packit |
875988 |
found_sendfile="yes, FreeBSD-style"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[found_sendfile]], [["no"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for Darwin-style sendfile(2)]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#include <sys/uio.h>
|
|
Packit |
875988 |
|
|
Packit |
875988 |
static void empty_func(void)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
/* Check for declaration */
|
|
Packit |
875988 |
(void)sendfile;
|
|
Packit |
875988 |
}
|
|
Packit |
875988 |
/* Declare again to check form match */
|
|
Packit |
875988 |
int sendfile(int, int, off_t, off_t*,
|
|
Packit |
875988 |
struct sf_hdtr *, int);
|
|
Packit |
875988 |
]],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
int fd=0, s=1;
|
|
Packit |
875988 |
off_t o = 0;
|
|
Packit |
875988 |
off_t l = 5;
|
|
Packit |
875988 |
int r;
|
|
Packit |
875988 |
r = sendfile (fd, s, o, &l, (void*)0, 0);
|
|
Packit |
875988 |
if (r)
|
|
Packit |
875988 |
empty_func();
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_DARWIN_SENDFILE], [1], [Define to 1 if you have Darwin-style sendfile(2).])
|
|
Packit |
875988 |
found_sendfile="yes, Darwin-style"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_VAR_IF([[found_sendfile]], [["no"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for Solaris-style sendfile(3)]])
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
LIBS="$LIBS -lsendfile"
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#include <sys/sendfile.h>
|
|
Packit |
875988 |
|
|
Packit |
875988 |
static void empty_func(void)
|
|
Packit |
875988 |
{
|
|
Packit |
875988 |
/* Check for declaration */
|
|
Packit |
875988 |
(void)sendfile;
|
|
Packit |
875988 |
}
|
|
Packit |
875988 |
/* Declare again to check form match */
|
|
Packit |
875988 |
ssize_t sendfile(int out_fd, int in_fd,
|
|
Packit |
875988 |
off_t *off, size_t len);
|
|
Packit |
875988 |
]],
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
int fd1=0, fd2=1;
|
|
Packit |
875988 |
off_t o = 0;
|
|
Packit |
875988 |
size_t l = 5;
|
|
Packit |
875988 |
ssize_t r;
|
|
Packit |
875988 |
r = sendfile (fd1, fd2, &o, l);
|
|
Packit |
875988 |
if (r)
|
|
Packit |
875988 |
empty_func();
|
|
Packit |
875988 |
]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([HAVE_SOLARIS_SENDFILE], [1], [Define to 1 if you have Solaris-style sendfile(3).])
|
|
Packit |
875988 |
found_sendfile="yes, Solaris-style"
|
|
Packit |
875988 |
MHD_LIBDEPS="-lsendfile $MHD_LIBDEPS"
|
|
Packit |
875988 |
MHD_LIBDEPS_PKGCFG="-lsendfile $MHD_LIBDEPS_PKGCFG"
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
AC_CHECK_FUNCS([sendfile64])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_IF([[test "x$found_sendfile" = "xno" && test "x$enable_sendfile" = "xyes"]],
|
|
Packit |
875988 |
AC_MSG_ERROR([[sendfile() usage was requested by configure parameter, but no usable sendfile() function is detected]])
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: have error messages ?
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to generate error messages]])
|
|
Packit |
875988 |
AC_ARG_ENABLE([messages],
|
|
Packit |
875988 |
[AS_HELP_STRING([--disable-messages],
|
|
Packit |
875988 |
[disable MHD error messages])],
|
|
Packit |
875988 |
[enable_messages=${enableval}],
|
|
Packit |
875988 |
[enable_messages=yes])
|
|
Packit |
875988 |
AS_IF([[test "x$enable_messages" = "xyes"]],
|
|
Packit |
875988 |
[ AC_DEFINE([HAVE_MESSAGES],[1],[Define to 1 to enable support for error messages.]) ],
|
|
Packit |
875988 |
[[ enable_messages=no ]])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_messages]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: have postprocessor?
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to enable postprocessor]])
|
|
Packit |
875988 |
AC_ARG_ENABLE([postprocessor],
|
|
Packit |
875988 |
[AS_HELP_STRING([--disable-postprocessor],
|
|
Packit |
875988 |
[disable MHD PostProcessor functionality])],
|
|
Packit |
875988 |
[enable_postprocessor=${enableval}],
|
|
Packit |
875988 |
[enable_postprocessor=yes])
|
|
Packit |
875988 |
AS_IF([[test "x$enable_postprocessor" != "xno"]],
|
|
Packit |
875988 |
[ enable_postprocessor=yes
|
|
Packit |
875988 |
AC_DEFINE([HAVE_POSTPROCESSOR],[1],[Define to 1 if libmicrohttpd is compiled with postprocessor support.]) ])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_POSTPROCESSOR], [test "x$enable_postprocessor" != "xno"])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_postprocessor]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: have zzuf, socat?
|
|
Packit |
875988 |
AC_CHECK_PROG([have_zzuf],[zzuf], [yes], [no])
|
|
Packit |
875988 |
AC_CHECK_PROG([have_socat],[socat], [yes], [no])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_ZZUF], [test "x$have_zzuf" = "xyes"])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_SOCAT], [test "x$have_socat" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
have_gnutls=no
|
|
Packit |
875988 |
have_gnutls_sni=no
|
|
Packit |
875988 |
have_gcrypt=no
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: HTTPS support. Enabled by default
|
|
Packit |
875988 |
AC_ARG_ENABLE([https],
|
|
Packit |
875988 |
[AS_HELP_STRING([--enable-https],
|
|
Packit |
875988 |
[enable HTTPS support (yes, no, auto)[auto]])],
|
|
Packit |
875988 |
[enable_https=${enableval}])
|
|
Packit |
875988 |
if test "x$enable_https" != "xno"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
# Next block is large unindented block
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# gnutls
|
|
Packit |
875988 |
have_gnutls_pkgcfg=no
|
|
Packit |
875988 |
AC_MSG_CHECKING([[how to find GnuTLS library]])
|
|
Packit |
875988 |
AC_ARG_WITH([[gnutls]],
|
|
Packit |
875988 |
[AS_HELP_STRING([[--with-gnutls[=PFX]]],[use GnuTLS for HTTPS support, optional PFX overrides pkg-config data for GnuTLS headers (PFX/include) and libs (PFX/lib)])],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
case $with_gnutls in
|
|
Packit |
875988 |
no)
|
|
Packit |
875988 |
AC_MSG_RESULT([[GnuTLS disabled]])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LIBS])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
yes)
|
|
Packit |
875988 |
AC_MSG_RESULT([[automatically, forced]])
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
*)
|
|
Packit |
875988 |
AC_MSG_RESULT([[-I$with_gnutls/include -L$with_gnutls/lib -lgnutls]])
|
|
Packit |
875988 |
SAVE_LDFLAGS="$LDFLAGS"
|
|
Packit |
875988 |
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
Packit |
875988 |
LDFLAGS="-L$with_gnutls/lib $LDFLAGS"
|
|
Packit |
875988 |
CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
|
|
Packit |
875988 |
have_gnutls_pkgcfg=no
|
|
Packit |
875988 |
AC_CHECK_HEADERS([gnutls/gnutls.h],
|
|
Packit |
875988 |
[AC_CHECK_LIB([gnutls], [gnutls_priority_set],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
GNUTLS_CPPFLAGS="-I$with_gnutls/include"
|
|
Packit |
875988 |
GNUTLS_LDFLAGS="-L$with_gnutls/lib"
|
|
Packit |
875988 |
GNUTLS_LIBS="-lgnutls"
|
|
Packit |
875988 |
have_gnutls=yes
|
|
Packit |
875988 |
])], [], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
AS_IF([test "x$have_gnutls" != "xyes"], [AC_MSG_ERROR([can't find usable libgnutls at specified prefix $with_gnutls])])
|
|
Packit |
875988 |
LDFLAGS="$SAVE_LDFLAGS"
|
|
Packit |
875988 |
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
Packit |
875988 |
;;
|
|
Packit |
875988 |
esac
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_MSG_RESULT([[automatically]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether to add pkg-config special search directories]], [mhd_cv_pkgconf_add_dirs],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AS_IF([[test "x$host_os" = "xsolaris2.11" && test "x$cross_compiling" = "xno"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
char size_chk[7-sizeof(char*)];
|
|
Packit |
875988 |
#if defined(_LP64) || defined(__LP64__) || defined(__x86_64) || defined(__x86_64__)
|
|
Packit |
875988 |
#error This is 64-bit target.
|
|
Packit |
875988 |
choke me now
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if defined(__amd64) || defined(__amd64__) || defined(__sparcv9) || defined(__sparc_v9__)
|
|
Packit |
875988 |
#error This is 64-bit target.
|
|
Packit |
875988 |
choke me now
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
mhd_cv_pkgconf_add_dirs='/usr/lib/pkgconfig/gnutls-3'
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AS_IF([[test "x$host_cpu" = "xx86_64" || test "x$host_cpu" = "xi386"]],
|
|
Packit |
875988 |
[[mhd_cv_pkgconf_add_dirs='/usr/lib/amd64/pkgconfig/gnutls-3:/usr/lib/amd64/pkgconfig']],
|
|
Packit |
875988 |
[[test "x$host_cpu" = "xsparc"]],
|
|
Packit |
875988 |
[[mhd_cv_pkgconf_add_dirs='/usr/lib/sparkv9/pkgconfig/gnutls-3:/usr/lib/sparkv9/pkgconfig']],
|
|
Packit |
875988 |
[[mhd_cv_pkgconf_add_dirs='/usr/lib/64/pkgconfig/gnutls-3:/usr/lib/64/pkgconfig']]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[[ mhd_cv_pkgconf_add_dirs='no' ]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_cv_pkgconf_add_dirs" != "xno"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
test "x$PKG_CONFIG_PATH" = "x" || PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PATH_SEPARATOR}"
|
|
Packit |
875988 |
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${mhd_cv_pkgconf_add_dirs}"
|
|
Packit |
875988 |
export PKG_CONFIG_PATH
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
PKG_CHECK_MODULES(GNUTLS, [[gnutls]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
have_gnutls_pkgcfg='yes'
|
|
Packit |
875988 |
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
Packit |
875988 |
SAVE_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
SAVE_LDFLAGS="$LDFLAGS"
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
CFLAGS="$GNUTLS_CFLAGS $CFLAGS"
|
|
Packit |
875988 |
LIBS="$LIBS $GNUTLS_LIBS"
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether GnuTLS is usable]])
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <gnutls/gnutls.h>
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
gnutls_session_t session;
|
|
Packit |
875988 |
gnutls_priority_t priorities;
|
|
Packit |
875988 |
gnutls_global_init();
|
|
Packit |
875988 |
gnutls_priority_init(&priorities, "NORMAL", NULL);
|
|
Packit |
875988 |
gnutls_init(&session, GNUTLS_SERVER);
|
|
Packit |
875988 |
gnutls_priority_set(session, priorities);
|
|
Packit |
875988 |
]])],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
have_gnutls=yes
|
|
Packit |
875988 |
# GNUTLS_CFLAGS is actually CPPFLAGS
|
|
Packit |
875988 |
GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS"
|
|
Packit |
875988 |
# GNUTLS_CFLAGS is combination of LDFLAGS and LIBS
|
|
Packit |
875988 |
GNUTLS_LDFLAGS="$GNUTLS_LIBS"
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
have_gnutls=no
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([test "x$have_gnutls" != "xyes"],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_MSG_WARN([pkg-config reports that GnuTLS is present, but GnuTLS can't be used])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LIBS])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
Packit |
875988 |
CFLAGS="$SAVE_CFLAGS"
|
|
Packit |
875988 |
LDFLAGS="$SAVE_LDFLAGS"
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
# check for GnuTLS at default paths
|
|
Packit |
875988 |
have_gnutls_pkgcfg='no'
|
|
Packit |
875988 |
AC_CHECK_HEADERS([gnutls/gnutls.h],
|
|
Packit |
875988 |
[AC_CHECK_LIB([gnutls], [gnutls_priority_set],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
GNUTLS_LIBS="-lgnutls"
|
|
Packit |
875988 |
have_gnutls=yes
|
|
Packit |
875988 |
])], [], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
have_gcrypt='unknown'
|
|
Packit |
875988 |
AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no])
|
|
Packit |
875988 |
AS_IF([[test "x$have_gcrypt" = "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
Packit |
875988 |
SAVE_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
SAVE_LDFLAGS="$LDFLAGS"
|
|
Packit |
875988 |
CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
|
|
Packit |
875988 |
# LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both
|
|
Packit |
875988 |
CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS"
|
|
Packit |
875988 |
AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
# Check for GnuTLS with gcrypt flags
|
|
Packit |
875988 |
LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS"
|
|
Packit |
875988 |
# A bit of hack: unset cache variable to force recheck
|
|
Packit |
875988 |
AS_UNSET([ac_cv_header_gnutls_gnutls_h])
|
|
Packit |
875988 |
AC_CHECK_HEADERS([gnutls/gnutls.h],
|
|
Packit |
875988 |
[AS_UNSET([ac_cv_lib_gnutls_gnutls_priority_set]) # A bit of hack: unset cache variable to force recheck
|
|
Packit |
875988 |
AC_CHECK_LIB([gnutls], [gnutls_priority_set],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
GNUTLS_CPPFLAGS="$LIBGCRYPT_CFLAGS"
|
|
Packit |
875988 |
GNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS"
|
|
Packit |
875988 |
GNUTLS_LDFLAGS="$LIBGCRYPT_LIBS"
|
|
Packit |
875988 |
GNUTLS_LIBS="-lgnutls"
|
|
Packit |
875988 |
have_gnutls=yes
|
|
Packit |
875988 |
])], [], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
Packit |
875988 |
CFLAGS="$SAVE_CFLAGS"
|
|
Packit |
875988 |
LDFLAGS="$SAVE_LDFLAGS"
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_IF([test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"], [AC_MSG_ERROR([[can't find usable libgnutls]])])
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
# End of large unindented block
|
|
Packit |
875988 |
#
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([test "x$have_gnutls" = "xyes"],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
Packit |
875988 |
SAVE_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
SAVE_LDFLAGS="$LDFLAGS"
|
|
Packit |
875988 |
SAVE_LIBS="$LIBS"
|
|
Packit |
875988 |
CPPFLAGS="$GNUTLS_CPPFLAGS $CPPFLAGS"
|
|
Packit |
875988 |
CFLAGS="$GNUTLS_CFLAGS $CFLAGS"
|
|
Packit |
875988 |
LDFLAGS="$GNUTLS_LDFLAGS $LDFLAGS"
|
|
Packit |
875988 |
LIBS="$LIBS $GNUTLS_LIBS"
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for gnutls_privkey_import_x509_raw()]])
|
|
Packit |
875988 |
AC_LINK_IFELSE([
|
|
Packit |
875988 |
AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <gnutls/gnutls.h>
|
|
Packit |
875988 |
#include <gnutls/abstract.h>
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
gnutls_datum_t data;
|
|
Packit |
875988 |
gnutls_privkey_t key = 0;
|
|
Packit |
875988 |
#ifndef gnutls_load_file
|
|
Packit |
875988 |
(void)gnutls_load_file; /* Check for declaration. */
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifndef gnutls_privkey_import_x509_raw
|
|
Packit |
875988 |
(void)gnutls_privkey_import_x509_raw; /* Check for declaration. */
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
gnutls_load_file("key.pem", &data);
|
|
Packit |
875988 |
gnutls_privkey_import_x509_raw(key, &data, GNUTLS_X509_FMT_PEM, NULL, 0);
|
|
Packit |
875988 |
gnutls_free(data.data);
|
|
Packit |
875988 |
]])], [[have_gnutls_sni=yes]], [[have_gnutls_sni=no]])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$have_gnutls_sni]])
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether GnuTLS require libgcrypt initialisaion]], [mhd_cv_grypt_required],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_COMPILE_IFELSE(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
#include <gnutls/gnutls.h>
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
#if !defined(GNUTLS_VERSION_NUMBER) || GNUTLS_VERSION_NUMBER+0 <= 0x020c14
|
|
Packit |
875988 |
#error Old versions of GnuTLS require libgcript initialisaion
|
|
Packit |
875988 |
choke me now
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[[mhd_cv_grypt_required='no']], [[mhd_cv_grypt_required='yes']]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
Packit |
875988 |
CFLAGS="$SAVE_CFLAGS"
|
|
Packit |
875988 |
LDFLAGS="$SAVE_LDFLAGS"
|
|
Packit |
875988 |
LIBS="$SAVE_LIBS"
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_cv_grypt_required" = "xyes" && test "x$have_gcrypt" = "xunknown"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no])
|
|
Packit |
875988 |
AS_IF([[test "x$have_gcrypt" = "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
Packit |
875988 |
SAVE_CFLAGS="$CFLAGS"
|
|
Packit |
875988 |
CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
|
|
Packit |
875988 |
# LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both
|
|
Packit |
875988 |
CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS"
|
|
Packit |
875988 |
AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT])
|
|
Packit |
875988 |
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
Packit |
875988 |
CFLAGS="$SAVE_CFLAGS"
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_UNSET([[crypt_missing]])
|
|
Packit |
875988 |
AS_IF([[test "x$have_gnutls" = "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_cv_grypt_required" = "xyes" && test "x$have_gcrypt" != "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
crypt_missing="required libgcrypt"
|
|
Packit |
875988 |
AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS support cannot be enabled without $crypt_missing.]])])
|
|
Packit |
875988 |
enable_https=no
|
|
Packit |
875988 |
MSG_HTTPS="no (lacking $crypt_missing)"
|
|
Packit |
875988 |
AS_UNSET([LIBGCRYPT_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([LIBGCRYPT_LIBS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LIBS])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([[HTTPS_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTPS support.])
|
|
Packit |
875988 |
enable_https=yes
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_cv_grypt_required" = "xyes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
MSG_HTTPS="yes (using libgnutls and libgcrypt)"
|
|
Packit |
875988 |
MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CPPFLAGS"
|
|
Packit |
875988 |
MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CFLAGS"
|
|
Packit |
875988 |
MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS"
|
|
Packit |
875988 |
MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS"
|
|
Packit |
875988 |
AC_DEFINE([[MHD_HTTPS_REQUIRE_GRYPT]], [[1]], [Define to `1' if HTTPS require initialisation of libgcrypt])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
MSG_HTTPS="yes (using libgnutls)"
|
|
Packit |
875988 |
AS_UNSET([LIBGCRYPT_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([LIBGCRYPT_LIBS])
|
|
Packit |
875988 |
MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $GNUTLS_CPPFLAGS"
|
|
Packit |
875988 |
MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $GNUTLS_CFLAGS"
|
|
Packit |
875988 |
MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS"
|
|
Packit |
875988 |
MHD_LIBDEPS="$GNUTLS_LIBS $MHD_LIBDEPS"
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_IF([[ test "x$have_gnutls_pkgcfg" = "xyes" ]],
|
|
Packit |
875988 |
[ # remove GnuTLS from private libs in .pc file as it defined in Requires.private
|
|
Packit |
875988 |
MHD_REQ_PRIVATE='gnutls'
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_cv_grypt_required" = "xyes"]],
|
|
Packit |
875988 |
[[MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG"]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
MHD_REQ_PRIVATE=''
|
|
Packit |
875988 |
AS_IF([[test "x$mhd_cv_grypt_required" = "xyes"]],
|
|
Packit |
875988 |
[[MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG"]]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
MHD_LIBDEPS_PKGCFG="$GNUTLS_LIBS $MHD_LIBDEPS_PKGCFG"
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
crypt_missing="libgnutls"
|
|
Packit |
875988 |
AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS support cannot be enabled without $crypt_missing.]])])
|
|
Packit |
875988 |
enable_https=no
|
|
Packit |
875988 |
MSG_HTTPS="no (lacking $crypt_missing)"
|
|
Packit |
875988 |
AS_UNSET([LIBGCRYPT_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([LIBGCRYPT_LIBS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_CFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
AS_UNSET([GNUTLS_LIBS])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
MSG_HTTPS="no (disabled)"
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
AC_MSG_CHECKING(whether to support HTTPS)
|
|
Packit |
875988 |
AC_MSG_RESULT([$MSG_HTTPS])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_GNUTLS], [[test "x$have_gnutls" = "xyes"]])
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_GNUTLS_SNI], [[test "x$have_gnutls_sni" = "xyes"]])
|
|
Packit |
875988 |
AM_CONDITIONAL([ENABLE_HTTPS], [test "x$enable_https" = "xyes"])
|
|
Packit |
875988 |
AM_CONDITIONAL([HTTPS_REQUIRE_GRYPT], [[test "x$enable_https" = "xyes" && test "x$mhd_cv_grypt_required" = "xyes"]])
|
|
Packit |
875988 |
AC_SUBST([GNUTLS_CPPFLAGS])
|
|
Packit |
875988 |
AC_SUBST([GNUTLS_CFLAGS])
|
|
Packit |
875988 |
AC_SUBST([GNUTLS_LDFLAGS])
|
|
Packit |
875988 |
AC_SUBST([GNUTLS_LIBS])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: HTTP Basic Auth support. Enabled by default
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to support HTTP basic authentication]])
|
|
Packit |
875988 |
AC_ARG_ENABLE([bauth],
|
|
Packit |
875988 |
AS_HELP_STRING([--disable-bauth],
|
|
Packit |
875988 |
[disable HTTP basic Auth support]),
|
|
Packit |
875988 |
[enable_bauth=${enableval}],
|
|
Packit |
875988 |
[enable_bauth=yes])
|
|
Packit |
875988 |
AS_IF([[test "x$enable_bauth" != "xno"]],
|
|
Packit |
875988 |
[ enable_bauth=yes
|
|
Packit |
875988 |
AC_DEFINE([BAUTH_SUPPORT],[1],[Define to 1 if libmicrohttpd is compiled with basic Auth support.]) ])
|
|
Packit |
875988 |
AM_CONDITIONAL([ENABLE_BAUTH], [test "x$enable_bauth" != "xno"])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_bauth]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: HTTP Digest Auth support. Enabled by default
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to support HTTP digest authentication]])
|
|
Packit |
875988 |
AC_ARG_ENABLE([dauth],
|
|
Packit |
875988 |
AS_HELP_STRING([--disable-dauth],
|
|
Packit |
875988 |
[disable HTTP basic and digest Auth support]),
|
|
Packit |
875988 |
[enable_dauth=${enableval}],
|
|
Packit |
875988 |
[enable_dauth=yes])
|
|
Packit |
875988 |
AS_IF([[test "x$enable_dauth" != "xno"]],
|
|
Packit |
875988 |
[ enable_dauth=yes
|
|
Packit |
875988 |
AC_DEFINE([DAUTH_SUPPORT],[1],[Define to 1 if libmicrohttpd is compiled with digest Auth support.]) ])
|
|
Packit |
875988 |
AM_CONDITIONAL([ENABLE_DAUTH], [test "x$enable_dauth" != "xno"])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_dauth]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# optional: HTTP "Upgrade" support. Enabled by default
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to support HTTP "Upgrade"]])
|
|
Packit |
875988 |
AC_ARG_ENABLE([[httpupgrade]],
|
|
Packit |
875988 |
AS_HELP_STRING([[--disable-httpupgrade]],
|
|
Packit |
875988 |
[disable HTTP "Upgrade" support]),
|
|
Packit |
875988 |
[AS_VAR_IF([[enable_httpupgrade]],[["no"]],[],[[enable_httpupgrade='yes']])],
|
|
Packit |
875988 |
[[enable_httpupgrade='yes']])
|
|
Packit |
875988 |
AS_VAR_IF([[enable_httpupgrade]],[["yes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([[UPGRADE_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support.]) ])
|
|
Packit |
875988 |
AM_CONDITIONAL([ENABLE_UPGRADE], [[test "x$enable_httpupgrade" = "xyes"]])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_httpupgrade]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CACHE_CHECK([[for calloc()]], [[mhd_cv_have_func_calloc]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|
Packit |
875988 |
#include <stdlib.h>
|
|
Packit |
875988 |
]],[[void * ptr = calloc(1, 2)]])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[[mhd_cv_have_func_calloc='yes']],
|
|
Packit |
875988 |
[[mhd_cv_have_func_calloc='no']]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Check for fork() and waitpid(). They are used for tests.
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for fork()]])
|
|
Packit |
875988 |
mhd_have_fork_waitpid='no'
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#ifdef HAVE_SYS_TYPES_H
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#ifdef HAVE_UNISTD_H
|
|
Packit |
875988 |
#include <unistd.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
pid_t p = fork ();
|
|
Packit |
875988 |
if (0 == p)
|
|
Packit |
875988 |
return 1;
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_FORK]], [[1]], [Define to 1 if you have the usable `fork' function.])
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_CHECKING([[for waitpid()]])
|
|
Packit |
875988 |
AC_LINK_IFELSE(
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LANG_PROGRAM(
|
|
Packit |
875988 |
[[
|
|
Packit |
875988 |
#include <sys/wait.h>
|
|
Packit |
875988 |
]], [[
|
|
Packit |
875988 |
pid_t p = fork ();
|
|
Packit |
875988 |
if (0 == p)
|
|
Packit |
875988 |
return 1;
|
|
Packit |
875988 |
waitpid (p, (void*)0, 0)
|
|
Packit |
875988 |
]])
|
|
Packit |
875988 |
], [
|
|
Packit |
875988 |
AC_DEFINE([[HAVE_WAITPID]], [[1]], [Define to 1 if you have the usable `waitpid' function.])
|
|
Packit |
875988 |
AC_MSG_RESULT([[yes]])
|
|
Packit |
875988 |
mhd_have_fork_waitpid='yes'
|
|
Packit |
875988 |
],[
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
],[
|
|
Packit |
875988 |
AC_MSG_RESULT([[no]])
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AM_CONDITIONAL([HAVE_FORK_WAITPID], [test "x$mhd_have_fork_waitpid" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# gcov compilation
|
|
Packit |
875988 |
AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
|
|
Packit |
875988 |
AC_ARG_ENABLE([coverage],
|
|
Packit |
875988 |
AS_HELP_STRING([--enable-coverage],
|
|
Packit |
875988 |
[compile the library with code coverage support]),
|
|
Packit |
875988 |
[use_gcov=${enableval}],
|
|
Packit |
875988 |
[use_gcov=no])
|
|
Packit |
875988 |
AC_MSG_RESULT($use_gcov)
|
|
Packit |
875988 |
AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AX_COUNT_CPUS
|
|
Packit |
875988 |
AS_IF([[test "$CPU_COUNT" -gt "32"]], [[CPU_COUNT="32"]])dnl Limit resource usage
|
|
Packit |
875988 |
AC_SUBST([CPU_COUNT])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_CHECKING([[whether to enable debug asserts]])
|
|
Packit |
875988 |
AC_ARG_ENABLE([[asserts]],
|
|
Packit |
875988 |
AS_HELP_STRING([[--enable-asserts]],
|
|
Packit |
875988 |
[enable test build with debug asserts]),
|
|
Packit |
875988 |
[], [[enable_asserts='no']])
|
|
Packit |
875988 |
AS_CASE([[$enable_asserts]], [[yes]], [[:]], [[no]], [[:]], [[enable_asserts='no']])
|
|
Packit |
875988 |
AC_MSG_RESULT([[$enable_asserts]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AS_VAR_IF([[enable_asserts]], [["yes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_DEFINE([[_DEBUG]], [[1]], [Define to use debug asserts.])
|
|
Packit |
875988 |
[mhd_assert_test_prg="#include <assert.h>
|
|
Packit |
875988 |
int pos_val(void) {return 5;}
|
|
Packit |
875988 |
int neg_val(void) {return -5;}
|
|
Packit |
875988 |
int main(void)
|
|
Packit |
875988 |
{ int pos_var = pos_val(), neg_var = neg_val();
|
|
Packit |
875988 |
assert(neg_var > pos_var); /* Must trigger assert. */
|
|
Packit |
875988 |
(void)pos_var; (void)neg_var;
|
|
Packit |
875988 |
return 0; }
|
|
Packit |
875988 |
"]
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether system assert() is available]], [mhd_cv_sys_assert_avail],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_LINK_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])],
|
|
Packit |
875988 |
[[mhd_cv_sys_assert_avail='yes']],
|
|
Packit |
875988 |
[[mhd_cv_sys_assert_avail='no']])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["yes"]],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_CACHE_CHECK([[whether system assert() is usable]], [mhd_cv_sys_assert_use],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
AC_RUN_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])],
|
|
Packit |
875988 |
[[mhd_cv_sys_assert_use='no']],
|
|
Packit |
875988 |
[[mhd_cv_sys_assert_use='yes']],
|
|
Packit |
875988 |
[[mhd_cv_sys_assert_use='assuming yes']])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_VAR_IF([[mhd_cv_sys_assert_use]], [["no"]], [],
|
|
Packit |
875988 |
[AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() and assert.h])])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
AS_UNSET([mhd_assert_test_prg])
|
|
Packit |
875988 |
],
|
|
Packit |
875988 |
[AC_DEFINE([[NDEBUG]], [[1]], [Define to disable usage of debug asserts.])]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined"
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_SUBST(MHD_LIB_CPPFLAGS)
|
|
Packit |
875988 |
AC_SUBST(MHD_LIB_CFLAGS)
|
|
Packit |
875988 |
AC_SUBST(MHD_LIB_LDFLAGS)
|
|
Packit |
875988 |
AC_SUBST(MHD_LIBDEPS)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# for pkg-config
|
|
Packit |
875988 |
AC_SUBST([MHD_REQ_PRIVATE])
|
|
Packit |
875988 |
AC_SUBST([MHD_LIBDEPS_PKGCFG])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_SUBST(CPPFLAGS)
|
|
Packit |
875988 |
AC_SUBST(LIBS)
|
|
Packit |
875988 |
AC_SUBST(LDFLAGS)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Used for 'po' directory staff
|
|
Packit |
875988 |
AC_SUBST([ac_configure_args])
|
|
Packit |
875988 |
AC_SUBST([EMPTY_VAR], [[]])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_CONFIG_FILES([libmicrohttpd.pc
|
|
Packit |
875988 |
w32/common/microhttpd_dll_res_vc.rc
|
|
Packit |
875988 |
po/configure.acT:po/configure.ac.in
|
|
Packit |
875988 |
Makefile
|
|
Packit |
875988 |
contrib/Makefile
|
|
Packit |
875988 |
doc/Makefile
|
|
Packit |
875988 |
doc/doxygen/libmicrohttpd.doxy
|
|
Packit |
875988 |
doc/doxygen/Makefile
|
|
Packit |
875988 |
doc/examples/Makefile
|
|
Packit |
875988 |
m4/Makefile
|
|
Packit |
875988 |
src/Makefile
|
|
Packit |
875988 |
src/include/Makefile
|
|
Packit |
875988 |
src/microhttpd/Makefile
|
|
Packit |
875988 |
src/examples/Makefile
|
|
Packit |
875988 |
src/testcurl/Makefile
|
|
Packit |
875988 |
src/testcurl/https/Makefile
|
|
Packit |
875988 |
src/testzzuf/Makefile])
|
|
Packit |
875988 |
AC_CONFIG_COMMANDS([po/configargs.stamp], [
|
|
Packit |
875988 |
$as_echo "$ac_configure_args" > "$ac_tmp/configargs.stamp" || AC_MSG_ERROR([[cannot create file $ac_tmp/configargs.stamp]])
|
|
Packit |
875988 |
AS_IF([[cmp -s "po/configargs.stamp" "$ac_tmp/configargs.stamp" >/dev/null 2>&1]],
|
|
Packit |
875988 |
[AC_MSG_NOTICE([[po/configargs.stamp is unchanged]])],
|
|
Packit |
875988 |
[
|
|
Packit |
875988 |
rm -f po/configargs.stamp
|
|
Packit |
875988 |
mv "$ac_tmp/configargs.stamp" po/configargs.stamp || AC_MSG_ERROR([[cannot create file $ac_tmp/configargs.stamp]])
|
|
Packit |
875988 |
AC_MSG_NOTICE([[po/configargs.stamp is updated]])
|
|
Packit |
875988 |
]
|
|
Packit |
875988 |
)
|
|
Packit |
875988 |
], [ac_configure_args="$ac_configure_args"])
|
|
Packit |
875988 |
AC_OUTPUT
|
|
Packit |
875988 |
|
|
Packit |
875988 |
# Finally: summary
|
|
Packit |
875988 |
if test "x$enable_curl" != "xyes"; then
|
|
Packit |
875988 |
MSG_CURL="no, many unit tests will not run"
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
MSG_CURL="yes"
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary:
|
|
Packit |
875988 |
Target directory: ${prefix}
|
|
Packit |
875988 |
Cross-compiling: ${cross_compiling}
|
|
Packit |
875988 |
Operating System: ${host_os}
|
|
Packit |
875988 |
Shutdown of listening socket trigger select: ${mhd_cv_host_shtdwn_trgr_select}
|
|
Packit |
875988 |
Inter-thread comm: ${use_itc}
|
|
Packit |
875988 |
poll support: ${enable_poll=no}
|
|
Packit |
875988 |
epoll support: ${enable_epoll=no}
|
|
Packit |
875988 |
sendfile used: ${found_sendfile}
|
|
Packit |
875988 |
HTTPS support: ${MSG_HTTPS}
|
|
Packit |
875988 |
Threading lib: ${USE_THREADS}
|
|
Packit |
875988 |
Use thread names: ${enable_thread_names}
|
|
Packit |
875988 |
Use debug asserts: ${enable_asserts}
|
|
Packit |
875988 |
Messages: ${enable_messages}
|
|
Packit |
875988 |
Basic auth.: ${enable_bauth}
|
|
Packit |
875988 |
Digest auth.: ${enable_dauth}
|
|
Packit |
875988 |
HTTP "Upgrade": ${enable_httpupgrade}
|
|
Packit |
875988 |
Postproc: ${enable_postprocessor}
|
|
Packit |
875988 |
Build docs: ${enable_doc}
|
|
Packit |
875988 |
Build examples: ${enable_examples}
|
|
Packit |
875988 |
Test with libcurl: ${MSG_CURL}
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if test "x$enable_https" = "xyes"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
AC_MSG_NOTICE([HTTPS subsystem configuration:
|
|
Packit |
875988 |
License : LGPL only
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
else
|
|
Packit |
875988 |
AC_MSG_NOTICE([
|
|
Packit |
875988 |
License : LGPL or eCos
|
|
Packit |
875988 |
])
|
|
Packit |
875988 |
fi
|
|
Packit |
875988 |
|
|
Packit |
875988 |
if test "x$enable_bauth" != "xyes" || \
|
|
Packit |
875988 |
test "x$enable_dauth" != "xyes" || \
|
|
Packit |
875988 |
test "x$enable_httpupgrade" != "xyes" || \
|
|
Packit |
875988 |
test "x$enable_postprocessor" != "xyes"
|
|
Packit |
875988 |
then
|
|
Packit |
875988 |
AC_MSG_NOTICE([WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems.])
|
|
Packit |
875988 |
fi
|