source: gsdl/trunk/lib/gsdlconf.h@ 14909

Last change on this file since 14909 was 14909, checked in by davidb, 15 years ago

Standardisation of Windows config file to lowercase (included from this source file). Was causing a problem when trying to compile on Unix filesystem mounted under Windows.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/**********************************************************************
2 *
3 * gsdlconf.h -- system specific includes
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26
27#ifndef GSDLCONF_H
28#define GSDLCONF_H
29
30#define GSDL_VERSION "svn-video"
31
32#if defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_) || defined(WIN32)
33#ifndef __WIN32__
34#define __WIN32__ 1
35#endif
36#endif
37
38#if defined(__WIN32__) && !defined(__CYGWIN__)
39#include "../win32cfg.h"
40#else
41#include "../config.h"
42#endif
43
44// Note: all macros used in the gsdl software (except the _H macros) should
45// now start with GSDL_
46
47// GSDL_NEED_STRINGS_H should be defined if some string functions
48// needed (like strcasecmp) are in strings.h
49#if defined(__IBMCPP__)
50# define GSDL_NEED_STRINGS_H
51#endif
52
53// GSDL_USE_IOS_H should be defined if the .h extension needs to
54// be used for the io stream headers
55#if (defined(__GNUG__) && __GNUG__ + 0 < 3) || defined(__IBMCPP__)
56# define GSDL_USE_IOS_H 1
57#endif
58
59// GSDL_USE_STL_H should be defined if the .h extension needs to
60// be used for the stl header files
61#if defined(__IBMCPP__)
62# define GSDL_USE_STL_H 1
63#endif
64
65// GSDL_USE_ALGO_H should be defined if algo.h should be used
66// instead of algorithm.h
67#if defined(__IBMCPP__)
68# define GSDL_USE_ALGO_H 1
69#endif
70
71// GSDL_NAMESPACE_BROKEN should be defined if namespaces should
72// not be used
73#if (defined(__GNUG__) && __GNUG__ + 0 < 3) || defined(__IBMCPP__)
74# define GSDL_NAMESPACE_BROKEN 1
75#endif
76
77// GSDL_USE_OBJECTSPACE should now be used instead of USE_OBJECTSPACE
78#if defined(USE_OBJECTSPACE)
79# define GSDL_USE_OBJECTSPACE
80#endif
81
82// GSDL_NEED_DESTROY_USHORT should be defined if the compiler needs
83// a definition for void destroy(short unsigned int *)
84#if defined(__IBMCPP__)
85# define GSDL_NEED_DESTROY_USHORT
86#endif
87
88// mktemp
89
90#if !defined(__WIN32__) || defined(__GNUC__)
91#include <unistd.h>
92#define GSDL_MKTEMP(str) mktemp(str)
93#else
94#include <io.h>
95#define GSDL_MKTEMP(str) _mktemp(str)
96#endif
97
98
99
100// file locking
101
102#if defined(__WIN32__)
103
104#if !defined(LK_UNLOCK) && defined(LK_UNLCK)
105#define LK_UNLOCK LK_UNLCK
106#endif
107
108#include <io.h>
109#include <sys/locking.h>
110
111#define GSDL_UNLOCK_FILE(fd) _locking(fd, LK_UNLCK, 200)
112#define GSDL_LOCK_FILE(fd) lock_val = _locking(fd, LK_NBLCK, 200)
113
114#else /* not WIN32 */
115
116#if GSDL_USE_FLOCK
117#include <sys/lock.h>
118
119#ifndef LOCK_SH
120#define LOCK_SH 1
121#endif
122
123#ifndef LOCK_EX
124#define LOCK_EX 2
125#endif
126
127#ifndef LOCK_NB
128#define LOCK_NB 4
129#endif
130
131#ifndef LOCK_UN
132#define LOCK_UN 8
133#endif
134
135#define GSDL_UNLOCK_FILE(fd) flock (fd, LOCK_UN)
136#define GSDL_LOCK_FILE(fd) lock_val = flock (fd, LOCK_EX + LOCK_NB)
137
138#else /* ! GSDL_USE_FLOCK */
139// use fcntl
140#include <fcntl.h>
141#define GSDL_UNLOCK_FILE(fd) \
142 { \
143 struct flock flock; \
144 flock.l_type = F_UNLCK; \
145 flock.l_whence = SEEK_SET; \
146 flock.l_start = flock.l_len = 0L; \
147 fcntl (fd, F_SETLK, &flock); \
148 }
149#define GSDL_LOCK_FILE(fd) \
150 { \
151 struct flock flock; \
152 flock.l_type = F_WRLCK; \
153 flock.l_whence = SEEK_SET; \
154 flock.l_start = flock.l_len = 0L; \
155 lock_val = fcntl (fd, F_SETLK, &flock); \
156 }
157
158#endif
159#endif
160
161#endif
Note: See TracBrowser for help on using the repository browser.