]> git.lyx.org Git - lyx.git/blob - src/xtl/config.h
fix typo that put too many include paths for most people
[lyx.git] / src / xtl / config.h
1 /*
2  * Automatic configuration file for XTL
3  *
4  * Copyright (C) 2000 Asger Nielsen, alstrup@sophusmedical.dk
5  * Copyright (C) 2000 Angus Leeming, a.leeming@ic.ac.uk
6  * Copyright (C) 2000 Jose' Orlando Pereira, jop@di.uminho.pt
7  */
8 /* XTL - eXternalization Template Library - http://gsd.di.uminho.pt/~jop/xtl
9  * Copyright (C) 1998-2000 Jose' Orlando Pereira, Universidade do Minho
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  * 
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  * 
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24  * MA 02111-1307, USA
25  *
26  * Id: config.h 1.7 Fri, 12 May 2000 18:23:14 +0100 jop 
27  */
28
29 #ifndef __XTL_CONFIG
30 #define __XTL_CONFIG
31
32 #define XTL_CONFIG_CHOICE_MACROS
33
34 #if defined(__GNUC__) 
35 #       if __GNUC__ >2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >=95 ) // >= G++ 2.95
36 #               define XTL_CONFIG_SIMPLE_CONTAINERS
37 #       endif
38
39         typedef long long longlong;
40         typedef unsigned long long unsignedlonglong;
41
42 #elif defined (__DECCXX)
43 #       define XTL_CONFIG_SIMPLE_CONTAINERS
44
45         typedef long long int longlong;
46         typedef unsigned long long int unsignedlonglong;
47
48 #elif defined (__sgi)
49 #       define XTL_CONFIG_SIMPLE_CONTAINERS
50
51         typedef long long int longlong;
52         typedef unsigned long long int unsignedlonglong;
53
54 #elif defined (_WIN32)
55
56 #       define XTL_CONFIG_COMPOSITE_BUG
57 #       define XTL_CONFIG_LACK_ENDIAN_H
58
59         typedef __int64  longlong;
60         typedef unsigned __int64  unsignedlonglong;
61
62         // Disable some stupid warnings
63 #       pragma warning(disable:4127 4786 4800)
64
65         // Work around for broken for-scoping with Visual C++ 6.0
66 #       define for if(0);else for
67
68         // Enable a bunch of useful warnings
69 #       pragma warning(3:4019 4032 4057 4061 4125 4130 4152 4189 4201 4706)
70
71 #endif
72
73 // Establish __BYTE_ORDER
74 #ifdef __linux__
75 #       include <endian.h>
76 #else
77 #       define __LITTLE_ENDIAN 1234
78 #       define __BIG_ENDIAN    4321
79 #endif
80
81 #if defined(__alpha) || defined(__alpha__)
82 #       ifndef __BYTE_ORDER
83 #               define __BYTE_ORDER __LITTLE_ENDIAN
84 #       endif
85                                             
86 #elif defined __sgi
87 #       ifndef __BYTE_ORDER
88 #               define __BYTE_ORDER __BIG_ENDIAN
89 #       endif
90 #endif
91
92 #if ((__BYTE_ORDER != __LITTLE_ENDIAN) && (__BYTE_ORDER != __BIG_ENDIAN))
93 #       error "Architecture not supported."
94 #endif
95
96 // Don't use byteswap.h on Alpha machines because its buggy
97 #if defined(__linux__) && !(defined(__alpha) || defined(__alpha__))
98 #       include <byteswap.h>
99 #else
100 inline unsigned short bswap_16(unsigned short b) {
101         return ((b&0xff00)>>8)|((b&0x00ff)>>8);
102 }
103
104 inline unsigned int bswap_32(unsigned int b) {
105         return ((b&0xff000000)>>24)|((b&0x00ff0000)>>8)|
106                 ((b&0x0000ff00)<<8)|((b&0x000000ff)<<24);
107 }
108
109 inline unsignedlonglong bswap_64(unsignedlonglong b) { 
110         return ( ((b&0xff00000000000000) >> 56) |
111                  ((b&0x00ff000000000000) >> 40) |
112                  ((b&0x0000ff0000000000) >> 24) |
113                  ((b&0x000000ff00000000) >> 8) |
114                  ((b&0x00000000ff000000) << 8) |
115                  ((b&0x0000000000ff0000) << 24) |
116                  ((b&0x000000000000ff00) << 40) |
117                  ((b&0x00000000000000ff) << 56) );
118 }
119 #endif
120
121 // We need this for memcpy
122 #if (defined(__alpha) || defined(__alpha__)) && !defined(__GNUC__)
123 #include <string.h>
124 #else
125 #include <cstring>
126 #endif
127
128 #endif