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

Last change on this file since 996 was 996, checked in by sjboddie, 24 years ago

include config.h

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 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 * $Id: gsdlconf.h 996 2000-02-29 21:52:31Z sjboddie $
25 *
26 *********************************************************************/
27
28
29#ifndef GSDLCONF_H
30#define GSDLCONF_H
31
32#ifndef __WIN32__
33#include "../config.h"
34#endif
35
36// Note: all macros used in the gsdl software (except the _H macros) should
37// now start with GSDL_
38
39// GSDL_NEED_STRINGS_H should be defined if some string functions
40// needed (like strcasecmp) are in strings.h
41#if defined(__IBMCPP__)
42# define GSDL_NEED_STRINGS_H
43#endif
44
45// GSDL_USE_IOS_H should be defined if the .h extension needs to
46// be used for the io stream headers
47#if defined(__GNUG__) || defined(__IBMCPP__)
48# define GSDL_USE_IOS_H 1
49#endif
50
51// GSDL_USE_STL_H should be defined if the .h extension needs to
52// be used for the stl header files
53#if defined(__IBMCPP__)
54# define GSDL_USE_STL_H 1
55#endif
56
57// GSDL_USE_ALGO_H should be defined if algo.h should be used
58// instead of algorithm.h
59#if defined(__IBMCPP__)
60# define GSDL_USE_ALGO_H 1
61#endif
62
63// GSDL_NAMESPACE_BROKEN should be defined if namespaces should
64// not be used
65#if defined(__GNUG__) || defined(__IBMCPP__)
66# define GSDL_NAMESPACE_BROKEN 1
67#endif
68
69// GSDL_USE_OBJECTSPACE should now be used instead of USE_OBJECTSPACE
70#if defined(USE_OBJECTSPACE)
71# define GSDL_USE_OBJECTSPACE
72#endif
73
74// GSDL_NEED_DESTROY_USHORT should be defined if the compiler needs
75// a definition for void destroy(short unsigned int *)
76#if defined(__IBMCPP__)
77# define GSDL_NEED_DESTROY_USHORT
78#endif
79
80
81// file locking
82
83#if defined(__WIN32__)
84#include <io.h>
85#include <sys/locking.h>
86#define GSDL_GET_FILEDESC(str) str.fd()
87#define GSDL_UNLOCK_FILE(fd) _locking(fd, LK_UNLCK, 200)
88#define GSDL_LOCK_FILE(fd) lock_val = _locking(fd, LK_NBLCK, 200)
89
90#else
91#define GSDL_GET_FILEDESC(str) str.filedesc()
92
93#if GSDL_USE_FLOCK
94#include <sys/lock.h>
95
96#ifndef LOCK_SH
97#define LOCK_SH 1
98#endif
99
100#ifndef LOCK_EX
101#define LOCK_EX 2
102#endif
103
104#ifndef LOCK_NB
105#define LOCK_NB 4
106#endif
107
108#ifndef LOCK_UN
109#define LOCK_UN 8
110#endif
111
112#define GSDL_UNLOCK_FILE(fd) flock (fd, LOCK_UN)
113#define GSDL_LOCK_FILE(fd) lock_val = flock (fd, LOCK_EX + LOCK_NB)
114
115#else
116// use fcntl
117#include <fcntl.h>
118#define GSDL_UNLOCK_FILE(fd) \
119 { \
120 struct flock flock; \
121 flock.l_type = F_UNLCK; \
122 flock.l_whence = SEEK_SET; \
123 flock.l_start = flock.l_len = 0L; \
124 fcntl (fd, F_SETLK, &flock); \
125 }
126#define GSDL_LOCK_FILE(fd) \
127 { \
128 struct flock flock; \
129 flock.l_type = F_WRLCK; \
130 flock.l_whence = SEEK_SET; \
131 flock.l_start = flock.l_len = 0L; \
132 lock_val = fcntl (fd, F_SETLK, &flock); \
133 }
134
135#endif
136#endif
137
138#endif
Note: See TracBrowser for help on using the repository browser.