17a6072eroberto
2047f369cy/**
3047f369cy * \file windows-config.h
4047f369cy *
5047f369cy *  This file contains all of the routines that must be linked into
6047f369cy *  an executable to use the generated option processing.  The optional
7047f369cy *  routines are in separately compiled modules so that they will not
8047f369cy *  necessarily be linked in.
9047f369cy *
10047f369cy *  This file is part of AutoOpts, a companion to AutoGen.
11047f369cy *  AutoOpts is free software.
125ef283fcy *  AutoOpts is Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
13d54cfbdroberto *
14047f369cy *  AutoOpts is available under any one of two licenses.  The license
15047f369cy *  in use must be one of these two and the choice is under the control
16047f369cy *  of the user of the license.
17d54cfbdroberto *
18047f369cy *   The GNU Lesser General Public License, version 3 or later
19047f369cy *      See the files "COPYING.lgplv3" and "COPYING.gplv3"
20d54cfbdroberto *
21047f369cy *   The Modified Berkeley Software Distribution License
22047f369cy *      See the file "COPYING.mbsd"
23d54cfbdroberto *
24047f369cy *  These files have the following sha256 sums:
25d54cfbdroberto *
26047f369cy *  8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95  COPYING.gplv3
27047f369cy *  4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b  COPYING.lgplv3
28047f369cy *  13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239  COPYING.mbsd
297a6072eroberto */
30047f369cy
317a6072eroberto#ifndef WINDOWS_CONFIG_HACKERY
327a6072eroberto#define WINDOWS_CONFIG_HACKERY 1
337a6072eroberto
347a6072eroberto/*
357a6072eroberto * The definitions below have been stolen from NTP's config.h for Windows.
367a6072eroberto * However, they may be kept here in order to keep libopts independent from
377a6072eroberto * the NTP project.
387a6072eroberto */
397a6072eroberto#ifndef __windows__
407a6072eroberto#  define __windows__ 4
417a6072eroberto#endif
427a6072eroberto
437a6072eroberto/*
44047f369cy * Miscellaneous functions that Microsoft maps to other names
457a6072eroberto */
467a6072eroberto#define snprintf _snprintf
477a6072eroberto
487a6072eroberto#define SIZEOF_INT   4
497a6072eroberto#define SIZEOF_CHARP 4
507a6072eroberto#define SIZEOF_LONG  4
517a6072eroberto#define SIZEOF_SHORT 2
527a6072eroberto
537a6072eroberto#define HAVE_LIMITS_H   1
547a6072eroberto#define HAVE_STRDUP     1
557a6072eroberto#define HAVE_STRCHR     1
567a6072eroberto#define HAVE_FCNTL_H    1
577a6072eroberto
587a6072eroberto/*
59047f369cy * VS.NET's version of wspiapi.h has a bug in it where it assigns a value
60047f369cy * to a variable inside an if statement. It should be comparing them.
61047f369cy * We prevent inclusion since we are not using this code so we don't have
62047f369cy * to see the warning messages
637a6072eroberto */
647a6072eroberto#ifndef _WSPIAPI_H_
657a6072eroberto#define _WSPIAPI_H_
667a6072eroberto#endif
677a6072eroberto
687a6072eroberto/* Prevent inclusion of winsock.h in windows.h */
697a6072eroberto#ifndef _WINSOCKAPI_
707a6072eroberto#define _WINSOCKAPI_
717a6072eroberto#endif
727a6072eroberto
737a6072eroberto#ifndef __RPCASYNC_H__
747a6072eroberto#define __RPCASYNC_H__
757a6072eroberto#endif
767a6072eroberto
777a6072eroberto/* Include Windows headers */
787a6072eroberto#include <windows.h>
797a6072eroberto#include <winsock2.h>
807a6072eroberto#include <limits.h>
817a6072eroberto
827a6072eroberto/*
837a6072eroberto * Compatibility declarations for Windows, assuming SYS_WINNT
847a6072eroberto * has been defined.
857a6072eroberto */
867a6072eroberto#define strdup  _strdup
877a6072eroberto#define stat    _stat       /* struct stat from <sys/stat.h> */
887a6072eroberto#define unlink  _unlink
89047f369cy#define fchmod( _x, _y )
907a6072eroberto#define ssize_t SSIZE_T
917a6072eroberto
927a6072eroberto#include <io.h>
937a6072eroberto#define open    _open
947a6072eroberto#define close   _close
957a6072eroberto#define read    _read
967a6072eroberto#define write   _write
977a6072eroberto#define lseek   _lseek
987a6072eroberto#define pipe    _pipe
997a6072eroberto#define dup2    _dup2
1007a6072eroberto
1017a6072eroberto#define O_RDWR     _O_RDWR
1027a6072eroberto#define O_RDONLY   _O_RDONLY
1037a6072eroberto#define O_EXCL     _O_EXCL
1047a6072eroberto
1057a6072eroberto#ifndef S_ISREG
1067a6072eroberto#  define S_IFREG _S_IFREG
1077a6072eroberto#  define       S_ISREG(mode)   (((mode) & S_IFREG) == S_IFREG)
1087a6072eroberto#endif
1097a6072eroberto
1107a6072eroberto#ifndef S_ISDIR
1117a6072eroberto#  define S_IFDIR _S_IFDIR
1127a6072eroberto#  define       S_ISDIR(mode)   (((mode) & S_IFDIR) == S_IFDIR)
1137a6072eroberto#endif
1147a6072eroberto
115047f369cy/* C99 exact size integer support. */
116047f369cy#if defined(HAVE_INTTYPES_H)
117047f369cy# include <inttypes.h>
118047f369cy
119047f369cy#elif defined(HAVE_STDINT_H)
120047f369cy# include <stdint.h>
121047f369cy# define MISSING_INTTYPES_H 1
122047f369cy
123047f369cy#elif ! defined(ADDED_EXACT_SIZE_INTEGERS)
124047f369cy# define ADDED_EXACT_SIZE_INTEGERS 1
125047f369cy# define MISSING_INTTYPES_H 1
126047f369cy
127047f369cy  typedef __int8 int8_t;
128047f369cy  typedef unsigned __int8 uint8_t;
129047f369cy
130047f369cy  typedef __int16 int16_t;
131047f369cy  typedef unsigned __int16 uint16_t;
132047f369cy
133047f369cy  typedef __int32 int32_t;
134047f369cy  typedef unsigned __int32 uint32_t;
135047f369cy
136047f369cy  typedef __int64 int64_t;
137047f369cy  typedef unsigned __int64 uint64_t;
138047f369cy
139047f369cy  typedef unsigned long uintptr_t;
140047f369cy  typedef long intptr_t;
141047f369cy#endif
142047f369cy
1437a6072eroberto#endif /* WINDOWS_CONFIG_HACKERY */
144047f369cy/* windows-config.h ends here */
145