|
Packit |
090c59 |
AC_INIT([Haskell network package], [2.6.3.1], [libraries@haskell.org], [network])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
ac_includes_default="$ac_includes_default
|
|
Packit |
090c59 |
#ifdef HAVE_SYS_SOCKET_H
|
|
Packit |
090c59 |
# include <sys/socket.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#ifdef HAVE_NETINET_IN_H
|
|
Packit |
090c59 |
# include <netinet/in.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#ifdef HAVE_NETDB_H
|
|
Packit |
090c59 |
# include <netdb.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#ifdef HAVE_WINSOCK2_H
|
|
Packit |
090c59 |
# include <winsock2.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#ifdef HAVE_WS2TCPIP_H
|
|
Packit |
090c59 |
# include <ws2tcpip.h>
|
|
Packit |
090c59 |
// fix for MingW not defining IPV6_V6ONLY
|
|
Packit |
090c59 |
# define IPV6_V6ONLY 27
|
|
Packit |
090c59 |
#endif"
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
# Safety check: Ensure that we are in the correct source directory.
|
|
Packit |
090c59 |
AC_CONFIG_SRCDIR([include/HsNet.h])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_CONFIG_HEADERS([include/HsNetworkConfig.h])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_CANONICAL_HOST
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_ARG_WITH([cc],
|
|
Packit |
090c59 |
[C compiler],
|
|
Packit |
090c59 |
[CC=$withval])
|
|
Packit |
090c59 |
AC_PROG_CC()
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_C_CONST
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl ** check for specific header (.h) files that we are interested in
|
|
Packit |
090c59 |
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h sys/types.h unistd.h winsock2.h ws2tcpip.h])
|
|
Packit |
090c59 |
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h sys/socket.h sys/uio.h sys/un.h linux/can.h linux/tcp.h])
|
|
Packit |
090c59 |
AC_CHECK_HEADERS([net/if.h])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_CHECK_FUNCS([readlink symlink if_nametoindex])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl ** check what fields struct msghdr contains
|
|
Packit |
090c59 |
AC_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_accrights], [], [], [#if HAVE_SYS_TYPES_H
|
|
Packit |
090c59 |
# include <sys/types.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#if HAVE_SYS_SOCKET_H
|
|
Packit |
090c59 |
# include <sys/socket.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#if HAVE_SYS_UIO_H
|
|
Packit |
090c59 |
# include <sys/uio.h>
|
|
Packit |
090c59 |
#endif])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl ** check if struct sockaddr contains sa_len
|
|
Packit |
090c59 |
AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [#if HAVE_SYS_TYPES_H
|
|
Packit |
090c59 |
# include <sys/types.h>
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
#if HAVE_SYS_SOCKET_H
|
|
Packit |
090c59 |
# include <sys/socket.h>
|
|
Packit |
090c59 |
#endif])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for in_addr_t
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for in_addr_t in netinet/in.h)
|
|
Packit |
090c59 |
AC_EGREP_HEADER(in_addr_t, netinet/in.h,
|
|
Packit |
090c59 |
[ AC_DEFINE([HAVE_IN_ADDR_T], [1], [Define to 1 if in_addr_t is available.]) AC_MSG_RESULT(yes) ],
|
|
Packit |
090c59 |
AC_MSG_RESULT(no))
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for SO_PEERCRED and struct ucred
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for SO_PEERCRED and struct ucred in sys/socket.h)
|
|
Packit |
090c59 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
|
Packit |
090c59 |
#include <sys/socket.h>
|
|
Packit |
090c59 |
#ifndef SO_PEERCRED
|
|
Packit |
090c59 |
# error no SO_PEERCRED
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
struct ucred u;]])],ac_cv_ucred=yes,ac_cv_ucred=no)
|
|
Packit |
090c59 |
if test "x$ac_cv_ucred" = xno; then
|
|
Packit |
090c59 |
old_CFLAGS="$CFLAGS"
|
|
Packit |
090c59 |
CFLAGS="-D_GNU_SOURCE $CFLAGS"
|
|
Packit |
090c59 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
|
Packit |
090c59 |
#include <sys/socket.h>
|
|
Packit |
090c59 |
#ifndef SO_PEERCRED
|
|
Packit |
090c59 |
# error no SO_PEERCRED
|
|
Packit |
090c59 |
#endif
|
|
Packit |
090c59 |
struct ucred u;]])],ac_cv_ucred=yes,ac_cv_ucred=no)
|
|
Packit |
090c59 |
if test "x$ac_cv_ucred" = xyes; then
|
|
Packit |
090c59 |
EXTRA_CPPFLAGS=-D_GNU_SOURCE
|
|
Packit |
090c59 |
fi
|
|
Packit |
090c59 |
else
|
|
Packit |
090c59 |
old_CFLAGS="$CFLAGS"
|
|
Packit |
090c59 |
fi
|
|
Packit |
090c59 |
if test "x$ac_cv_ucred" = xno; then
|
|
Packit |
090c59 |
CFLAGS="$old_CFLAGS"
|
|
Packit |
090c59 |
AC_MSG_RESULT(no)
|
|
Packit |
090c59 |
else
|
|
Packit |
090c59 |
AC_DEFINE([HAVE_STRUCT_UCRED], [1], [Define to 1 if you have both SO_PEERCRED and struct ucred.])
|
|
Packit |
090c59 |
AC_MSG_RESULT(yes)
|
|
Packit |
090c59 |
fi
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for GETPEEREID(3)
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for getpeereid in unistd.h)
|
|
Packit |
090c59 |
AC_CHECK_FUNC( getpeereid, AC_DEFINE([HAVE_GETPEEREID], [1], [Define to 1 if you have getpeereid.] ))
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * check for Windows networking libraries
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_CHECK_LIB(ws2_32, _head_libws2_32_a)
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for getaddrinfo as proxy for IPv6 support
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for getaddrinfo)
|
|
Packit |
090c59 |
dnl Can't use AC_CHECK_FUNC here, because it doesn't do the right
|
|
Packit |
090c59 |
dnl thing on Windows.
|
|
Packit |
090c59 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default
|
|
Packit |
090c59 |
int testme(){ getaddrinfo; }]])],[AC_DEFINE([HAVE_GETADDRINFO], [1], [Define to 1 if you have the `getaddrinfo' function.]) ac_have_getaddrinfo=yes; AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl Under mingw, we may need to set WINVER to 0x0501 to expose getaddrinfo.
|
|
Packit |
090c59 |
if test "x$ac_have_getaddrinfo" = x; then
|
|
Packit |
090c59 |
old_CFLAGS="$CFLAGS"
|
|
Packit |
090c59 |
if test "z$ac_cv_lib_ws2_32__head_libws2_32_a" = zyes; then
|
|
Packit |
090c59 |
CFLAGS="-DWINVER=0x0501 $CFLAGS"
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for getaddrinfo if WINVER is 0x0501)
|
|
Packit |
090c59 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default
|
|
Packit |
090c59 |
int testme(){ getaddrinfo; }]])],[AC_DEFINE([HAVE_GETADDRINFO], [1], [Define to 1 if you have the `getaddrinfo' function.]) AC_DEFINE([NEED_WINVER_XP], [1], [Define to 1 if the `getaddrinfo' function needs WINVER set.]) EXTRA_CPPFLAGS="-DWINVER=0x0501 $EXTRA_CPPFLAGS"; AC_MSG_RESULT(yes)],[CFLAGS="$old_CFLAGS"; AC_MSG_RESULT(no)])
|
|
Packit |
090c59 |
fi
|
|
Packit |
090c59 |
fi
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl Missing under mingw, sigh.
|
|
Packit |
090c59 |
AC_CHECK_FUNCS(gai_strerror)
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl -------------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for AI_* flags that not all implementations have
|
|
Packit |
090c59 |
dnl -------------------------------------------------------
|
|
Packit |
090c59 |
AC_CHECK_DECLS([AI_ADDRCONFIG, AI_ALL, AI_NUMERICSERV, AI_V4MAPPED])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl -------------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for IPV6_V6ONLY flags that not all implementations have
|
|
Packit |
090c59 |
dnl -------------------------------------------------------
|
|
Packit |
090c59 |
AC_CHECK_DECLS([IPV6_V6ONLY])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl -------------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for IPPROTO_* macros/constants
|
|
Packit |
090c59 |
dnl -------------------------------------------------------
|
|
Packit |
090c59 |
AC_CHECK_DECLS([IPPROTO_IP, IPPROTO_TCP, IPPROTO_IPV6])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for Linux sendfile(2)
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for sendfile in sys/sendfile.h)
|
|
Packit |
090c59 |
AC_EGREP_HEADER(sendfile, sys/sendfile.h,
|
|
Packit |
090c59 |
[ AC_DEFINE([HAVE_LINUX_SENDFILE], [1], [Define to 1 if you have a Linux sendfile(2) implementation.]) AC_MSG_RESULT(yes) ],
|
|
Packit |
090c59 |
AC_MSG_RESULT(no))
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
dnl * test for BSD sendfile(2)
|
|
Packit |
090c59 |
dnl --------------------------------------------------
|
|
Packit |
090c59 |
AC_MSG_CHECKING(for sendfile in sys/socket.h)
|
|
Packit |
090c59 |
AC_EGREP_HEADER(sendfile, sys/socket.h,
|
|
Packit |
090c59 |
[ AC_DEFINE([HAVE_BSD_SENDFILE], [1], [Define to 1 if you have a BSDish sendfile(2) implementation.]) AC_MSG_RESULT(yes) ],
|
|
Packit |
090c59 |
AC_MSG_RESULT(no))
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_CHECK_FUNCS(gethostent)
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_CHECK_FUNCS(accept4)
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
case "$host" in
|
|
Packit |
090c59 |
*-mingw* | *-msys*)
|
|
Packit |
090c59 |
EXTRA_SRCS="cbits/initWinSock.c, cbits/winSockErr.c, cbits/asyncAccept.c"
|
|
Packit |
090c59 |
EXTRA_LIBS=ws2_32
|
|
Packit |
090c59 |
CALLCONV=stdcall ;;
|
|
Packit |
090c59 |
*-solaris2*)
|
|
Packit |
090c59 |
EXTRA_SRCS="cbits/ancilData.c"
|
|
Packit |
090c59 |
EXTRA_LIBS="nsl, socket"
|
|
Packit |
090c59 |
CALLCONV=ccall ;;
|
|
Packit |
090c59 |
*)
|
|
Packit |
090c59 |
EXTRA_SRCS="cbits/ancilData.c"
|
|
Packit |
090c59 |
EXTRA_LIBS=
|
|
Packit |
090c59 |
CALLCONV=ccall ;;
|
|
Packit |
090c59 |
esac
|
|
Packit |
090c59 |
AC_SUBST([CALLCONV])
|
|
Packit |
090c59 |
AC_SUBST([EXTRA_CPPFLAGS])
|
|
Packit |
090c59 |
AC_SUBST([EXTRA_LIBS])
|
|
Packit |
090c59 |
AC_SUBST([EXTRA_SRCS])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_CONFIG_FILES([network.buildinfo])
|
|
Packit |
090c59 |
|
|
Packit |
090c59 |
AC_OUTPUT
|