Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update network 2.7 no buildinfo callconv #323

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Network/BSD.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
-----------------------------------------------------------------------------

#include "HsNet.h"
##include "HsNetDef.h"

module Network.BSD {-# DEPRECATED "This platform dependent module is no longer supported." #-}
(
Expand Down
3 changes: 1 addition & 2 deletions Network/Socket.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
-----------------------------------------------------------------------------

#include "HsNet.h"

-- In order to process this file, you need to have CALLCONV defined.
##include "HsNetDef.h"

module Network.Socket
(
Expand Down
1 change: 1 addition & 0 deletions Network/Socket/Internal.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-----------------------------------------------------------------------------

#include "HsNet.h"
##include "HsNetDef.h"

module Network.Socket.Internal
(
Expand Down
1 change: 1 addition & 0 deletions Network/Socket/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE ForeignFunctionInterface #-}

#include "HsNet.h"
##include "HsNetDef.h"

module Network.Socket.Types
(
Expand Down
9 changes: 4 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ else
fi

dnl --------------------------------------------------
dnl * test for GETPEEREID(3)
dnl * test for GETPEEREID(3)
dnl --------------------------------------------------
AC_MSG_CHECKING(for getpeereid in unistd.h)
AC_CHECK_FUNC( getpeereid, AC_DEFINE([HAVE_GETPEEREID], [1], [Define to 1 if you have getpeereid.] ))
Expand Down Expand Up @@ -173,17 +173,16 @@ case "$host" in
*-mingw* | *-msys*)
EXTRA_SRCS="cbits/initWinSock.c, cbits/winSockErr.c, cbits/asyncAccept.c"
EXTRA_LIBS=ws2_32
CALLCONV=stdcall ;;
;;
*-solaris2*)
EXTRA_SRCS="cbits/ancilData.c"
EXTRA_LIBS="nsl, socket"
CALLCONV=ccall ;;
;;
*)
EXTRA_SRCS="cbits/ancilData.c"
EXTRA_LIBS=
CALLCONV=ccall ;;
;;
esac
AC_SUBST([CALLCONV])
AC_SUBST([EXTRA_CPPFLAGS])
AC_SUBST([EXTRA_LIBS])
AC_SUBST([EXTRA_SRCS])
Expand Down
25 changes: 1 addition & 24 deletions include/HsNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@
#ifndef HSNET_H
#define HSNET_H

#include "HsNetworkConfig.h"
#include "HsNetDef.h"

#ifdef NEED_WINVER
# define WINVER 0x0501
#endif

/* ultra-evil... */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION

#ifndef INLINE
# if defined(_MSC_VER)
# define INLINE extern __inline
Expand Down Expand Up @@ -161,22 +154,6 @@ hsnet_freeaddrinfo(struct addrinfo *ai)
}
#endif

#if defined(HAVE_WINSOCK2_H)
# define WITH_WINSOCK 1
#endif

#if !defined(mingw32_HOST_OS) && !defined(_WIN32)
# define DOMAIN_SOCKET_SUPPORT 1
#endif

#if !defined(CALLCONV)
# if defined(WITH_WINSOCK)
# define CALLCONV stdcall
# else
# define CALLCONV ccall
# endif
#endif

#if !defined(IOV_MAX)
# define IOV_MAX 1024
#endif
Expand Down
45 changes: 45 additions & 0 deletions include/HsNetDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef HSNETDEF_H
#define HSNETDEF_H

#include "HsNetworkConfig.h"

/* ultra-evil... */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION

#if defined(HAVE_WINSOCK2_H)
# define WITH_WINSOCK 1
#endif

#if !defined(mingw32_HOST_OS) && !defined(_WIN32)
# define DOMAIN_SOCKET_SUPPORT 1
#endif

/* stdcall is for Windows 32.
Haskell FFI does not have a keyword for Windows 64.
If ccall/stdcall is specified on Windows 64,
GHC ignores it and use a proper ABI for Windows 64.
But if stdcall is specified, GHC displays a warning.
So, let's use ccall for Windows 64.
*/
#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define CALLCONV stdcall
# elif defined(x86_64_HOST_ARCH)
# define CALLCONV ccall
# else
# error Unknown mingw32 arch
# endif
#else
# define CALLCONV ccall
#endif
#if defined(mingw32_HOST_OS)
# define SAFE_ON_WIN safe
#else
# define SAFE_ON_WIN unsafe
#endif

#endif /* HSNETDEF_H */
6 changes: 3 additions & 3 deletions network.buildinfo.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ghc-options: -DCALLCONV=@CALLCONV@ @EXTRA_CPPFLAGS@
ghc-prof-options: -DCALLCONV=@CALLCONV@ @EXTRA_CPPFLAGS@
ghc-options: @EXTRA_CPPFLAGS@
ghc-prof-options: @EXTRA_CPPFLAGS@
ld-options: @LDFLAGS@
cc-options: -DCALLCONV=@CALLCONV@ @EXTRA_CPPFLAGS@
cc-options: @EXTRA_CPPFLAGS@
c-sources: @EXTRA_SRCS@
extra-libraries: @EXTRA_LIBS@
install-includes: HsNetworkConfig.h
2 changes: 1 addition & 1 deletion network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extra-source-files:
README.md CHANGELOG.md
examples/*.hs tests/*.hs config.guess config.sub install-sh
configure.ac configure network.buildinfo.in
include/HsNetworkConfig.h.in include/HsNet.h
include/HsNetworkConfig.h.in include/HsNet.h include/HsDef.h
-- C sources only used on some systems
cbits/ancilData.c cbits/asyncAccept.c cbits/initWinSock.c
cbits/winSockErr.c
Expand Down
2 changes: 0 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
resolver: lts-9.18
packages:
- '.'
ghc-options:
"*": -DCALLCONV=ccall
nix:
packages: [ ncurses ]

Expand Down