Skip to content

Commit

Permalink
change PE_COMPAT to WINDOWS_COMPAT
Browse files Browse the repository at this point in the history
  • Loading branch information
gyf304 committed Mar 20, 2020
1 parent a37c4ca commit 4f238c3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 21 deletions.
14 changes: 2 additions & 12 deletions configure.ac
Expand Up @@ -400,28 +400,18 @@ AC_SUBST([DL_LDFLAGS])
dnl On mingw we should define _spawnv
AC_MSG_CHECKING(whether _spawnv needs to be defined)
AS_CASE([$host_os],
[mingw*], [CFLAGS="$CFLAGS -D_spawnv=spawnv"; AC_MSG_RESULT(yes)],
[mingw*|msys*|cyg*], [CFLAGS="$CFLAGS -D_spawnv=spawnv"; AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
)

dnl On mingw we should enable the -no-undefined flag
AC_MSG_CHECKING(whether -no-undefined is needed for shared libraries)
AS_CASE([$host_os],
[mingw*], [SHARED_LDFLAGS="$SHARED_LDFLAGS -no-undefined"; AC_MSG_RESULT(yes)],
[mingw*|msys*|cyg*], [SHARED_LDFLAGS="$SHARED_LDFLAGS -no-undefined"; AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
)
AC_SUBST([SHARED_LDFLAGS])

dnl On mingw we should enable MINGW specific flags
AC_MSG_CHECKING([if we should enable MINGW specific flags])
AS_CASE([$host_os],
[mingw*], [mingw=yes],
[mingw=no]
)
AC_MSG_RESULT([$mingw])
AM_CONDITIONAL([MINGW],
[test "x$mingw" = "xyes"])

dnl Check for dladdr in -ldl, optional. This is a glibc extension.
old_LIBS="$LIBS"
LIBS="$DL_LIBS $LIBS"
Expand Down
2 changes: 1 addition & 1 deletion include/nbdkit-common.h
Expand Up @@ -77,7 +77,7 @@ extern "C" {
#define NBDKIT_EXTENT_HOLE (1<<0) /* Same as NBD_STATE_HOLE */
#define NBDKIT_EXTENT_ZERO (1<<1) /* Same as NBD_STATE_ZERO */

#if defined(NBDKIT_INTERNAL) || !defined(PE_COMPAT)
#if defined(NBDKIT_INTERNAL) || !defined(WINDOWS_COMPAT)
extern void nbdkit_error (const char *msg, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
extern void nbdkit_verror (const char *msg, va_list args)
ATTRIBUTE_FORMAT_PRINTF (1, 0);
Expand Down
4 changes: 2 additions & 2 deletions include/nbdkit-compat.h
Expand Up @@ -38,12 +38,12 @@
#endif

#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER)
#define PE_COMPAT
#define WINDOWS_COMPAT
#endif

struct nbdkit_extents;

#if defined(PE_COMPAT)
#if defined(WINDOWS_COMPAT)
#include <string.h>
#include <stdarg.h>
#include <stdint.h>
Expand Down
4 changes: 2 additions & 2 deletions include/nbdkit-filter.h
Expand Up @@ -110,7 +110,7 @@ struct nbdkit_extent {
uint32_t type;
};

#if defined(NBDKIT_INTERNAL) || !defined(PE_COMPAT)
#if defined(NBDKIT_INTERNAL) || !defined(WINDOWS_COMPAT)
extern struct nbdkit_extents *nbdkit_extents_new (uint64_t start, uint64_t end);
extern void nbdkit_extents_free (struct nbdkit_extents *);
extern size_t nbdkit_extents_count (const struct nbdkit_extents *);
Expand Down Expand Up @@ -224,7 +224,7 @@ struct nbdkit_filter {
int *err);
};

#if defined(PE_COMPAT)
#if defined(WINDOWS_COMPAT)
#define NBDKIT_REGISTER_FILTER(filter) \
NBDKIT_CXX_LANG_C \
struct nbdkit_filter * \
Expand Down
4 changes: 2 additions & 2 deletions include/nbdkit-plugin.h
Expand Up @@ -140,7 +140,7 @@ struct nbdkit_plugin {
int (*get_ready) (void);
};

#if defined(NBDKIT_INTERNAL) || !defined(PE_COMPAT)
#if defined(NBDKIT_INTERNAL) || !defined(WINDOWS_COMPAT)
extern void nbdkit_set_error (int err);
#else
static void nbdkit_set_error (int err)
Expand All @@ -149,7 +149,7 @@ static void nbdkit_set_error (int err)
}
#endif

#if defined(PE_COMPAT)
#if defined(WINDOWS_COMPAT)
#define NBDKIT_REGISTER_PLUGIN(plugin) \
NBDKIT_CXX_LANG_C \
struct nbdkit_plugin * \
Expand Down
4 changes: 2 additions & 2 deletions server/main.c
Expand Up @@ -833,7 +833,7 @@ open_plugin_so (size_t i, const char *name, int short_name)

/* Initialize the plugin. See dlopen(3) to understand C weirdness. */
dlerror ();
#ifdef PE_COMPAT
#ifdef WINDOWS_COMPAT
*(void **) (&functions_init) = dlsym (dl, "functions_init");
if ((error = dlerror ()) != NULL) {
fprintf (stderr, "%s: cannot find functions_init in %s: %s, %d\n",
Expand Down Expand Up @@ -896,7 +896,7 @@ open_filter_so (struct backend *next, size_t i,

/* Initialize the filter. See dlopen(3) to understand C weirdness. */
dlerror ();
#ifdef PE_COMPAT
#ifdef WINDOWS_COMPAT
*(void **) (&functions_init) = dlsym (dl, "functions_init");
if ((error = dlerror ()) != NULL) {
fprintf (stderr, "%s: %s: %s\n", program_name, name, error);
Expand Down

0 comments on commit 4f238c3

Please sign in to comment.