From 40952aa7ff4650c0683fa5f85b2c56fac03fce9f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 16 Jun 2010 21:47:54 +0000 Subject: [PATCH] generalize the windows.h as well as the IN/OUT checks via normal configure tests rather than hardcoding to specific OS checks (should fix building with some cygwin versions) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1793 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 +++++ urjtag/configure.ac | 17 +++++++++++++++++ urjtag/sysdep.h | 6 +----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 3e185870..fc50d874 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -6,6 +6,11 @@ * configure.ac (AC_CHECK_FUNCS): Check for geteuid and getuid functions. * sysdep.h: Key off of HAVE_xxx defines for geteuid/getuid stubs. + * configure.ac (AC_CHECK_HEADERS): Move windows.h check here, as well as + IN/OUT namespace pollution checks. + * sysdep.h: Key off of HAVE_WINDOWS_H for windows.h include. Drop the + NO_W32_PSEUDO_MODIFIERS defines since they're in configure.ac now. + 2010-06-15 Mike Frysinger * src/bus/s3c4510x.c: Punt dead/useless cvs log info. diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 8764fc29..ca9a8c9e 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -140,9 +140,26 @@ AC_CHECK_HEADERS([linux/ppdev.h], [HAVE_LINUX_PPDEV_H="yes"]) AC_CHECK_HEADERS([dev/ppbus/ppi.h], [HAVE_DEV_PPBUS_PPI_H="yes"]) AC_CHECK_HEADERS(m4_flatten([ wchar.h + windows.h sys/wait.h ])) +dnl See if the windows target is polluting the namespace on us which +dnl will break some of the lex/yacc (e.g. bsdl) builds. We need both +dnl defines as some versions of mingw have changed names over time. +AS_IF([test "x$ac_cv_header_windows_h" = "xyes"],[ + AC_MSG_CHECKING([for IN/OUT defines in windows.h]) + AC_TRY_COMPILE([#include ], [ +#if defined(IN) || defined(OUT) +# error "IN/OUT defined" +#endif +], + [AC_MSG_RESULT([no])],[ + AS_VAR_APPEND([CPPFLAGS], " -DNO_W32_PSEUDO_MODIFIERS -D_NO_W32_PSEUDO_MODIFIERS") + AC_MSG_RESULT([yes]) + ]) +]) + VL_LIB_READLINE diff --git a/urjtag/sysdep.h b/urjtag/sysdep.h index 65966745..bf3429c9 100644 --- a/urjtag/sysdep.h +++ b/urjtag/sysdep.h @@ -43,15 +43,11 @@ #define ngettext(s,p,n) s #endif -#if __CYGWIN__ +#ifdef HAVE_WINDOWS_H #include #endif #ifdef __MINGW32__ -/* Diff versions of mingw used slightly different names */ -#define NO_W32_PSEUDO_MODIFIERS -#define _NO_W32_PSEUDO_MODIFIERS -#include /* Microsoft uses a different swprintf() than ISO C requires */ #include #define swprintf _snwprintf