From 6f0330c78467bb9b5154ffb1859f6b9850235b7a Mon Sep 17 00:00:00 2001 From: Chris Dickens Date: Thu, 9 Apr 2020 11:46:03 -0700 Subject: configure.ac: Simplify detection of Windows compilation There are a few parts within the library where code is conditionally compiled based on whether or not the target OS is Windows. Prior to commit 8b09dd490d ("core: Kill the OS_* definitions and use in the source code"), the OS_WINDOWS definition was used. With that definition gone, the checks were replaced with _WIN32. Unfortunately the different cross-platform toolchains do not universally define this, so add this to AM_CPPFLAGS when building for Windows. Signed-off-by: Chris Dickens --- configure.ac | 7 +++++++ examples/fxload.c | 4 ++-- libusb/version_nano.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d2d5b6f..2aaa9e6 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,7 @@ LT_LDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age} -no-undefined" m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +EXTRA_CPPFLAGS= EXTRA_CFLAGS= dnl check for -std=gnu11 compiler support (optional) @@ -192,6 +193,9 @@ sunos) windows) AC_CHECK_TYPES([struct timespec], [], [], [[#include ]]) AC_DEFINE([_WIN32_WINNT], [_WIN32_WINNT_VISTA], [Define to the oldest supported Windows version.]) + dnl Cygwin and MSYS compilers do not define _WIN32 as MinGW and MSVC do + dnl simplify checks for Windows compilation by ensuring it is always defined + EXTRA_CPPFLAGS="-D_WIN32" LT_LDFLAGS="${LT_LDFLAGS} -avoid-version -Wl,--add-stdcall-alias" ;; *) @@ -328,6 +332,9 @@ fi SHARED_CFLAGS="-Wall -Wextra -Wshadow -Wunused -Wwrite-strings -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=init-self -Werror=missing-prototypes -Werror=strict-prototypes -Werror=undef -Werror=uninitialized" +AM_CPPFLAGS="${EXTRA_CPPFLAGS}" +AC_SUBST(AM_CPPFLAGS) + AM_CFLAGS="-std=${c_dialect}11 ${EXTRA_CFLAGS} ${SHARED_CFLAGS}" AC_SUBST(AM_CFLAGS) diff --git a/examples/fxload.c b/examples/fxload.c index 1cea9c3..114b19b 100644 --- a/examples/fxload.c +++ b/examples/fxload.c @@ -32,7 +32,7 @@ #include "libusb.h" #include "ezusb.h" -#if !defined(_WIN32) || defined(__CYGWIN__ ) +#if !defined(_WIN32) || defined(__CYGWIN__) #include static bool dosyslog = false; #include @@ -55,7 +55,7 @@ void logerror(const char *format, ...) va_list ap; va_start(ap, format); -#if !defined(_WIN32) || defined(__CYGWIN__ ) +#if !defined(_WIN32) || defined(__CYGWIN__) if (dosyslog) vsyslog(LOG_ERR, format, ap); else diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 232a43c..07b0839 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11487 +#define LIBUSB_NANO 11488 -- cgit v1.2.1