Skip to content

Commit 3828ea6

Browse files
committed
deps: ntlmclient: fix missing htonll symbols on FreeBSD and SunOS
The ntlmclient dependency defines htonll on Linux-based systems, only. As a result, non-Linux systems will run into compiler and/or linker errors due to undefined symbols. Fix this issue for FreeBSD, OpenBSD and SunOS/OpenSolaris by including the proper headers and defining the symbol accordingly.
1 parent 1722390 commit 3828ea6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

deps/ntlmclient/compat.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,30 @@
2222
#endif
2323

2424
#ifdef __linux__
25+
/* See man page endian(3) */
2526
# include <endian.h>
2627
# define htonll htobe64
28+
#elif defined(__OpenBSD__)
29+
/* See man page htobe64(3) */
30+
# include <endian.h>
31+
# define htonll htobe64
32+
#elif defined(__FreeBSD__)
33+
/* See man page bwaps64(9) */
34+
# include <sys/endian.h>
35+
# define htonll bswap64
36+
#elif defined(sun) || defined(__sun)
37+
/* See man page byteorder(3SOCKET) */
38+
# include <sys/types.h>
39+
# include <netinet/in.h>
40+
# include <inttypes.h>
41+
42+
# if !defined(htonll)
43+
# if defined(_BIG_ENDIAN)
44+
# define htonll(x) (x)
45+
# else
46+
# define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl((uint64_t)(x) >> 32))
47+
# endif
48+
# endif
2749
#endif
2850

2951
#ifndef MIN

0 commit comments

Comments
 (0)