Currently Windows builds of e2fsprogs rely on the Windows Socket API
(Winsock) to provide htonl() and ntohl(). For this to actually work,
though, HAVE_WINSOCK_H needs to be defined, and the binaries need to be
linked to -lws2_32. The Android.bp files do this; however, the
autotools-based build system does not.
Since htonl() and ntohl() are trivial, let's instead just add a file
include/mingw/arpa/inet.h with definitions for these.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
--- /dev/null
+#pragma once
+
+/* Windows is always little endian. */
+#define htonl __builtin_bswap32
+#define ntohl __builtin_bswap32
"-Wno-unused-variable",
"-Wno-error=typedef-redefinition",
],
-
- host_ldlibs: [
- "-lws2_32",
- ],
},
},
"-Wno-unused-variable",
"-Wno-error=typedef-redefinition",
],
-
- host_ldlibs: ["-lws2_32"],
},
},
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#else
#include <arpa/inet.h>
-#endif
#include <stdbool.h>
#define printk printf
"-Wno-error"
],
ldflags: ["-static"],
- host_ldlibs: ["-lws2_32"],
enabled: true
},
android: {
#if defined(_WIN32)
# define HAVE_LINUX_TYPES_H 1
-# define HAVE_WINSOCK_H 1
#endif
#if defined(__APPLE__) || defined(__linux__)
# define HAVE_FCNTL 1