1181834Sroberto
2280849Scy/**
3280849Scy * \file windows-config.h
4280849Scy *
5280849Scy *  This file contains all of the routines that must be linked into
6280849Scy *  an executable to use the generated option processing.  The optional
7280849Scy *  routines are in separately compiled modules so that they will not
8280849Scy *  necessarily be linked in.
9280849Scy *
10280849Scy *  This file is part of AutoOpts, a companion to AutoGen.
11280849Scy *  AutoOpts is free software.
12285169Scy *  AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
13280849Scy *
14280849Scy *  AutoOpts is available under any one of two licenses.  The license
15280849Scy *  in use must be one of these two and the choice is under the control
16280849Scy *  of the user of the license.
17280849Scy *
18280849Scy *   The GNU Lesser General Public License, version 3 or later
19280849Scy *      See the files "COPYING.lgplv3" and "COPYING.gplv3"
20280849Scy *
21280849Scy *   The Modified Berkeley Software Distribution License
22280849Scy *      See the file "COPYING.mbsd"
23280849Scy *
24280849Scy *  These files have the following sha256 sums:
25280849Scy *
26280849Scy *  8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95  COPYING.gplv3
27280849Scy *  4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b  COPYING.lgplv3
28280849Scy *  13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239  COPYING.mbsd
29181834Sroberto */
30280849Scy
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/*
44280849Scy * 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/*
59280849Scy * VS.NET's version of wspiapi.h has a bug in it where it assigns a value
60280849Scy * to a variable inside an if statement. It should be comparing them.
61280849Scy * We prevent inclusion since we are not using this code so we don't have
62280849Scy * 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
89280849Scy#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
115280849Scy/* C99 exact size integer support. */
116280849Scy#if defined(HAVE_INTTYPES_H)
117280849Scy# include <inttypes.h>
118280849Scy
119280849Scy#elif defined(HAVE_STDINT_H)
120280849Scy# include <stdint.h>
121280849Scy# define MISSING_INTTYPES_H 1
122280849Scy
123280849Scy#elif ! defined(ADDED_EXACT_SIZE_INTEGERS)
124280849Scy# define ADDED_EXACT_SIZE_INTEGERS 1
125280849Scy# define MISSING_INTTYPES_H 1
126280849Scy
127280849Scy  typedef __int8 int8_t;
128280849Scy  typedef unsigned __int8 uint8_t;
129280849Scy
130280849Scy  typedef __int16 int16_t;
131280849Scy  typedef unsigned __int16 uint16_t;
132280849Scy
133280849Scy  typedef __int32 int32_t;
134280849Scy  typedef unsigned __int32 uint32_t;
135280849Scy
136280849Scy  typedef __int64 int64_t;
137280849Scy  typedef unsigned __int64 uint64_t;
138280849Scy
139280849Scy  typedef unsigned long uintptr_t;
140280849Scy  typedef long intptr_t;
141280849Scy#endif
142280849Scy
143181834Sroberto#endif /* WINDOWS_CONFIG_HACKERY */
144280849Scy/* windows-config.h ends here */
145