summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2020-04-09 11:46:03 -0700
committerChris Dickens <christopher.a.dickens@gmail.com>2020-04-09 11:46:03 -0700
commit6f0330c78467bb9b5154ffb1859f6b9850235b7a (patch)
treec72050ca60c5e75d8769abc7fbcd958b5f143a19
parent7c0cea7063413fad636d586dde74acde37f4c5b9 (diff)
downloadlibusb-6f0330c78467bb9b5154ffb1859f6b9850235b7a.tar.gz
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 <christopher.a.dickens@gmail.com>
-rw-r--r--configure.ac7
-rw-r--r--examples/fxload.c4
-rw-r--r--libusb/version_nano.h2
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 <time.h>]])
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 <syslog.h>
static bool dosyslog = false;
#include <strings.h>
@@ -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