windows-config.h revision 1.2
1/* $NetBSD: windows-config.h,v 1.2 2014/12/19 20:43:20 christos Exp $ */ 2 3 4/** 5 * \file windows-config.h 6 * 7 * This file contains all of the routines that must be linked into 8 * an executable to use the generated option processing. The optional 9 * routines are in separately compiled modules so that they will not 10 * necessarily be linked in. 11 * 12 * This file is part of AutoOpts, a companion to AutoGen. 13 * AutoOpts is free software. 14 * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved 15 * 16 * AutoOpts is available under any one of two licenses. The license 17 * in use must be one of these two and the choice is under the control 18 * of the user of the license. 19 * 20 * The GNU Lesser General Public License, version 3 or later 21 * See the files "COPYING.lgplv3" and "COPYING.gplv3" 22 * 23 * The Modified Berkeley Software Distribution License 24 * See the file "COPYING.mbsd" 25 * 26 * These files have the following sha256 sums: 27 * 28 * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 29 * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 30 * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd 31 */ 32 33#ifndef WINDOWS_CONFIG_HACKERY 34#define WINDOWS_CONFIG_HACKERY 1 35 36/* 37 * The definitions below have been stolen from NTP's config.h for Windows. 38 * However, they may be kept here in order to keep libopts independent from 39 * the NTP project. 40 */ 41#ifndef __windows__ 42# define __windows__ 4 43#endif 44 45/* 46 * Miscellaneous functions that Microsoft maps to other names 47 */ 48#define snprintf _snprintf 49 50#define SIZEOF_INT 4 51#define SIZEOF_CHARP 4 52#define SIZEOF_LONG 4 53#define SIZEOF_SHORT 2 54 55#define HAVE_LIMITS_H 1 56#define HAVE_STRDUP 1 57#define HAVE_STRCHR 1 58#define HAVE_FCNTL_H 1 59 60/* 61 * VS.NET's version of wspiapi.h has a bug in it where it assigns a value 62 * to a variable inside an if statement. It should be comparing them. 63 * We prevent inclusion since we are not using this code so we don't have 64 * to see the warning messages 65 */ 66#ifndef _WSPIAPI_H_ 67#define _WSPIAPI_H_ 68#endif 69 70/* Prevent inclusion of winsock.h in windows.h */ 71#ifndef _WINSOCKAPI_ 72#define _WINSOCKAPI_ 73#endif 74 75#ifndef __RPCASYNC_H__ 76#define __RPCASYNC_H__ 77#endif 78 79/* Include Windows headers */ 80#include <windows.h> 81#include <winsock2.h> 82#include <limits.h> 83 84/* 85 * Compatibility declarations for Windows, assuming SYS_WINNT 86 * has been defined. 87 */ 88#define strdup _strdup 89#define stat _stat /* struct stat from <sys/stat.h> */ 90#define unlink _unlink 91#define fchmod( _x, _y ) 92#define ssize_t SSIZE_T 93 94#include <io.h> 95#define open _open 96#define close _close 97#define read _read 98#define write _write 99#define lseek _lseek 100#define pipe _pipe 101#define dup2 _dup2 102 103#define O_RDWR _O_RDWR 104#define O_RDONLY _O_RDONLY 105#define O_EXCL _O_EXCL 106 107#ifndef S_ISREG 108# define S_IFREG _S_IFREG 109# define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG) 110#endif 111 112#ifndef S_ISDIR 113# define S_IFDIR _S_IFDIR 114# define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) 115#endif 116 117/* C99 exact size integer support. */ 118#if defined(HAVE_INTTYPES_H) 119# include <inttypes.h> 120 121#elif defined(HAVE_STDINT_H) 122# include <stdint.h> 123# define MISSING_INTTYPES_H 1 124 125#elif ! defined(ADDED_EXACT_SIZE_INTEGERS) 126# define ADDED_EXACT_SIZE_INTEGERS 1 127# define MISSING_INTTYPES_H 1 128 129 typedef __int8 int8_t; 130 typedef unsigned __int8 uint8_t; 131 132 typedef __int16 int16_t; 133 typedef unsigned __int16 uint16_t; 134 135 typedef __int32 int32_t; 136 typedef unsigned __int32 uint32_t; 137 138 typedef __int64 int64_t; 139 typedef unsigned __int64 uint64_t; 140 141 typedef unsigned long uintptr_t; 142 typedef long intptr_t; 143#endif 144 145#endif /* WINDOWS_CONFIG_HACKERY */ 146/* windows-config.h ends here */ 147