1181834Sroberto 2290001Sglebius/** 3290001Sglebius * \file windows-config.h 4290001Sglebius * 5290001Sglebius * This file contains all of the routines that must be linked into 6290001Sglebius * an executable to use the generated option processing. The optional 7290001Sglebius * routines are in separately compiled modules so that they will not 8290001Sglebius * necessarily be linked in. 9290001Sglebius * 10290001Sglebius * This file is part of AutoOpts, a companion to AutoGen. 11290001Sglebius * AutoOpts is free software. 12290001Sglebius * AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved 13290001Sglebius * 14290001Sglebius * AutoOpts is available under any one of two licenses. The license 15290001Sglebius * in use must be one of these two and the choice is under the control 16290001Sglebius * of the user of the license. 17290001Sglebius * 18290001Sglebius * The GNU Lesser General Public License, version 3 or later 19290001Sglebius * See the files "COPYING.lgplv3" and "COPYING.gplv3" 20290001Sglebius * 21290001Sglebius * The Modified Berkeley Software Distribution License 22290001Sglebius * See the file "COPYING.mbsd" 23290001Sglebius * 24290001Sglebius * These files have the following sha256 sums: 25290001Sglebius * 26290001Sglebius * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 27290001Sglebius * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 28290001Sglebius * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd 29181834Sroberto */ 30290001Sglebius 31181834Sroberto#ifndef WINDOWS_CONFIG_HACKERY 32181834Sroberto#define WINDOWS_CONFIG_HACKERY 1 33181834Sroberto 34181834Sroberto/* 35181834Sroberto * The definitions below have been stolen from NTP's config.h for Windows. 36181834Sroberto * However, they may be kept here in order to keep libopts independent from 37181834Sroberto * the NTP project. 38181834Sroberto */ 39181834Sroberto#ifndef __windows__ 40181834Sroberto# define __windows__ 4 41181834Sroberto#endif 42181834Sroberto 43181834Sroberto/* 44290001Sglebius * Miscellaneous functions that Microsoft maps to other names 45181834Sroberto */ 46181834Sroberto#define snprintf _snprintf 47181834Sroberto 48181834Sroberto#define SIZEOF_INT 4 49181834Sroberto#define SIZEOF_CHARP 4 50181834Sroberto#define SIZEOF_LONG 4 51181834Sroberto#define SIZEOF_SHORT 2 52181834Sroberto 53181834Sroberto#define HAVE_LIMITS_H 1 54181834Sroberto#define HAVE_STRDUP 1 55181834Sroberto#define HAVE_STRCHR 1 56181834Sroberto#define HAVE_FCNTL_H 1 57181834Sroberto 58181834Sroberto/* 59290001Sglebius * VS.NET's version of wspiapi.h has a bug in it where it assigns a value 60290001Sglebius * to a variable inside an if statement. It should be comparing them. 61290001Sglebius * We prevent inclusion since we are not using this code so we don't have 62290001Sglebius * to see the warning messages 63181834Sroberto */ 64181834Sroberto#ifndef _WSPIAPI_H_ 65181834Sroberto#define _WSPIAPI_H_ 66181834Sroberto#endif 67181834Sroberto 68181834Sroberto/* Prevent inclusion of winsock.h in windows.h */ 69181834Sroberto#ifndef _WINSOCKAPI_ 70181834Sroberto#define _WINSOCKAPI_ 71181834Sroberto#endif 72181834Sroberto 73181834Sroberto#ifndef __RPCASYNC_H__ 74181834Sroberto#define __RPCASYNC_H__ 75181834Sroberto#endif 76181834Sroberto 77181834Sroberto/* Include Windows headers */ 78181834Sroberto#include <windows.h> 79181834Sroberto#include <winsock2.h> 80181834Sroberto#include <limits.h> 81181834Sroberto 82181834Sroberto/* 83181834Sroberto * Compatibility declarations for Windows, assuming SYS_WINNT 84181834Sroberto * has been defined. 85181834Sroberto */ 86181834Sroberto#define strdup _strdup 87181834Sroberto#define stat _stat /* struct stat from <sys/stat.h> */ 88181834Sroberto#define unlink _unlink 89290001Sglebius#define fchmod( _x, _y ) 90181834Sroberto#define ssize_t SSIZE_T 91181834Sroberto 92181834Sroberto#include <io.h> 93181834Sroberto#define open _open 94181834Sroberto#define close _close 95181834Sroberto#define read _read 96181834Sroberto#define write _write 97181834Sroberto#define lseek _lseek 98181834Sroberto#define pipe _pipe 99181834Sroberto#define dup2 _dup2 100181834Sroberto 101181834Sroberto#define O_RDWR _O_RDWR 102181834Sroberto#define O_RDONLY _O_RDONLY 103181834Sroberto#define O_EXCL _O_EXCL 104181834Sroberto 105181834Sroberto#ifndef S_ISREG 106181834Sroberto# define S_IFREG _S_IFREG 107181834Sroberto# define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG) 108181834Sroberto#endif 109181834Sroberto 110181834Sroberto#ifndef S_ISDIR 111181834Sroberto# define S_IFDIR _S_IFDIR 112181834Sroberto# define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) 113181834Sroberto#endif 114181834Sroberto 115290001Sglebius/* C99 exact size integer support. */ 116290001Sglebius#if defined(HAVE_INTTYPES_H) 117290001Sglebius# include <inttypes.h> 118290001Sglebius 119290001Sglebius#elif defined(HAVE_STDINT_H) 120290001Sglebius# include <stdint.h> 121290001Sglebius# define MISSING_INTTYPES_H 1 122290001Sglebius 123290001Sglebius#elif ! defined(ADDED_EXACT_SIZE_INTEGERS) 124290001Sglebius# define ADDED_EXACT_SIZE_INTEGERS 1 125290001Sglebius# define MISSING_INTTYPES_H 1 126290001Sglebius 127290001Sglebius typedef __int8 int8_t; 128290001Sglebius typedef unsigned __int8 uint8_t; 129290001Sglebius 130290001Sglebius typedef __int16 int16_t; 131290001Sglebius typedef unsigned __int16 uint16_t; 132290001Sglebius 133290001Sglebius typedef __int32 int32_t; 134290001Sglebius typedef unsigned __int32 uint32_t; 135290001Sglebius 136290001Sglebius typedef __int64 int64_t; 137290001Sglebius typedef unsigned __int64 uint64_t; 138290001Sglebius 139290001Sglebius typedef unsigned long uintptr_t; 140290001Sglebius typedef long intptr_t; 141290001Sglebius#endif 142290001Sglebius 143181834Sroberto#endif /* WINDOWS_CONFIG_HACKERY */ 144290001Sglebius/* windows-config.h ends here */ 145