From 65bb211e00aa6f282f3bc6c647011f242822c581 Mon Sep 17 00:00:00 2001 From: Eric J Korpela Date: Sat, 3 May 2014 13:09:10 -0700 Subject: [PATCH] More fixes for diagnostics cross compile. --- configure.ac | 73 ++++++++++++++++++++++++++++++++++--------- lib/diagnostics_win.h | 15 +++++---- 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 0f6ea83f5d..02960600c8 100644 --- a/configure.ac +++ b/configure.ac @@ -630,13 +630,11 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME AC_TYPE_SIGNAL -AC_CHECK_HEADERS(winsock2.h winsock.h windows.h ws2tcpip.h winternl.h delayimp.h ntapi.h ddk/ntapi.h crtdbg.h sys/types.h sys/un.h arpa/inet.h dirent.h grp.h fcntl.h inttypes.h stdint.h memory.h netdb.h netinet/in.h netinet/tcp.h netinet/ether.h net/if.h net/if_arp.h signal.h strings.h sys/auxv.h sys/file.h sys/fcntl.h sys/ipc.h sys/ioctl.h sys/msg.h sys/param.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/socket.h sys/stat.h sys/statvfs.h sys/statfs.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h procfs.h ieeefp.h setjmp.h) +AC_CHECK_HEADERS(winsock2.h winsock.h windows.h ws2tcpip.h winternl.h crtdbg.h sys/types.h sys/un.h arpa/inet.h dirent.h grp.h fcntl.h inttypes.h stdint.h memory.h netdb.h netinet/in.h netinet/tcp.h netinet/ether.h net/if.h net/if_arp.h signal.h strings.h sys/auxv.h sys/file.h sys/fcntl.h sys/ipc.h sys/ioctl.h sys/msg.h sys/param.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/socket.h sys/stat.h sys/statvfs.h sys/statfs.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h procfs.h ieeefp.h setjmp.h float.h) if test x${ac_cv_header_windows_h} = xyes ; then -AC_CHECK_HEADER(winhttp.h, [ -AC_DEFINE(HAVE_WINHTTP_H,1,[Define to 1 if your compiler has the security.h header file]) -], [], [[ +AC_CHECK_HEADERS([winhttp.h ntapi.h ddk/ntapi.h dbghelp.h delayimp.h],[], [], [[ #if HAVE_WINDOWS_H # include #endif @@ -652,15 +650,19 @@ AC_DEFINE(SECURITY_WIN32,1,[Define to 1 if your compiler has the security.h head #endif ]]) -AC_CHECK_HEADER(dbghelp.h, [ -AC_DEFINE(HAVE_DBGHELP_H,1,[Define to 1 if your compiler has the dbghelp.h header]) -], [], [[ +AC_CHECK_TYPES([SYSTEM_PROCESSES, CLIENT_ID, VM_COUNTERS, SYSTEM_THREADS, THREAD_STATE, THREAD_WAIT_REASON],[],[],[[ #if HAVE_WINDOWS_H -# include +#include +#endif +#ifdef HAVE_WINTERNL_H +#include +#elif defined(HAVE_DDK_NTAPI_H) +#include +#elif defined(HAVE_NTAPI_H) +#include #endif ]]) - fi AC_CHECK_TYPES([socklen_t],[],[],[[ @@ -699,7 +701,6 @@ AC_CHECK_TYPES([socklen_t],[],[],[[ #endif ]]) - AC_CHECK_HEADER(net/if.h, [], [], [[ #if HAVE_SYS_SOCKET_H # include @@ -793,10 +794,54 @@ AC_PROG_GCC_TRADITIONAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(ether_ntoa setpriority sched_setscheduler strlcpy strlcat strcasestr strcasecmp sigaction getutent setutent getisax strdup strdupa daemon stat64 putenv setenv unsetenv res_init strtoull) -AC_CHECK_DECLS(_fpreset, - AC_DEFINE(HAVE_DECL__FPRESET,1,[Define to 1 if the function _fpreset() is declared])) -AC_CHECK_DECLS(fpreset, - AC_DEFINE(HAVE_DECL_FPRESET,1,[Define to 1 if the function _fpreset() is declared])) +AC_CHECK_DECLS([_fpreset, fpreset], + [],[],[[ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDINT_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_WINDOWS_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_IEEEFP_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif +]]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/lib/diagnostics_win.h b/lib/diagnostics_win.h index 698aac64c5..82af90d14a 100644 --- a/lib/diagnostics_win.h +++ b/lib/diagnostics_win.h @@ -20,9 +20,6 @@ #include "boinc_win.h" -#define DECLARE_WINTERNL_STRUCTURES (!defined(__MINGW32__) || !(defined(HAVE_WINTERNL_H) || defined(HAVE_DDK_NTAPI_H))) - - #define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) typedef LONG NTSTATUS; @@ -30,7 +27,7 @@ typedef LONG NTSTATUS; typedef LONG KPRIORITY; //MinGW-W64 defines this struct in its own header -#if DECLARE_WINTERNL_STRUCTURES +#ifndef HAVE_CLIENT_ID typedef struct _CLIENT_ID { DWORD UniqueProcess; DWORD UniqueThread; @@ -38,7 +35,7 @@ typedef struct _CLIENT_ID { #endif //MinGW-W64 defines this struct in its own header -#if DECLARE_WINTERNL_STRUCTURES +#ifndef HAVE_VM_COUNTERS typedef struct _VM_COUNTERS { #ifdef _WIN64 // the following was inferred by painful reverse engineering @@ -70,7 +67,7 @@ typedef struct _VM_COUNTERS { #endif //MinGW-W64 defines this struct in its own header -#if DECLARE_WINTERNL_STRUCTURES +#ifndef HAVE_SYSTEM_THREADS typedef struct _SYSTEM_THREADS { LARGE_INTEGER KernelTime; LARGE_INTEGER UserTime; @@ -86,7 +83,7 @@ typedef struct _SYSTEM_THREADS { } SYSTEM_THREADS, * PSYSTEM_THREADS; #endif -#if DECLARE_WINTERNL_STRUCTURES +#ifndef HAVE_SYSTEM_PROCESSES typedef struct _SYSTEM_PROCESSES { ULONG NextEntryDelta; ULONG ThreadCount; @@ -115,7 +112,7 @@ typedef struct _SYSTEM_PROCESSES { #endif //MinGW-W64 defines this struct in its own header -#if DECLARE_WINTERNL_STRUCTURES +#ifndef HAVE_THREAD_STATE typedef enum _THREAD_STATE { StateInitialized, StateReady, @@ -127,6 +124,7 @@ typedef enum _THREAD_STATE { } THREAD_STATE, *PTHREAD_STATE; #endif +#ifndef HAVE_THREAD_WAIT_REASON typedef enum _THREAD_WAIT_REASON { ThreadWaitReasonExecutive, ThreadWaitReasonFreePage, @@ -150,5 +148,6 @@ typedef enum _THREAD_WAIT_REASON { ThreadWaitReasonWrPageOut, ThreadWaitReasonMaximumWaitReason } THREAD_WAIT_REASON; +#endif #endif