Externalize publically-needed configure macros and fix GSS-related bugs.
[shibboleth/sp.git] / shibsp / base.h
1 /*
2  *  Copyright 2001-2011 Internet2
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file shibsp/base.h
19  *
20  * Base header file definitions
21  * Must be included prior to including any other header
22  */
23
24 #ifndef __shibsp_base_h__
25 #define __shibsp_base_h__
26
27 #ifdef SHIBSP_LITE
28 # define XMLTOOLING_LITE
29 # include <xmltooling/base.h>
30 #else
31 # include <saml/base.h>
32 #endif
33
34 #if defined (_MSC_VER) || defined(__BORLANDC__)
35   #include <shibsp/config_pub_win32.h>
36 #else
37   #include <shibsp/config_pub.h>
38 #endif
39
40 // Windows and GCC4 Symbol Visibility Macros
41 #ifdef WIN32
42   #define SHIBSP_IMPORT __declspec(dllimport)
43   #define SHIBSP_EXPORT __declspec(dllexport)
44   #define SHIBSP_DLLLOCAL
45   #define SHIBSP_DLLPUBLIC
46 #else
47   #define SHIBSP_IMPORT
48   #ifdef GCC_HASCLASSVISIBILITY
49     #define SHIBSP_EXPORT __attribute__ ((visibility("default")))
50     #define SHIBSP_DLLLOCAL __attribute__ ((visibility("hidden")))
51     #define SHIBSP_DLLPUBLIC __attribute__ ((visibility("default")))
52   #else
53     #define SHIBSP_EXPORT
54     #define SHIBSP_DLLLOCAL
55     #define SHIBSP_DLLPUBLIC
56   #endif
57 #endif
58
59 // Define SHIBSP_API for DLL builds
60 #ifdef SHIBSP_EXPORTS
61   #define SHIBSP_API SHIBSP_EXPORT
62 #else
63   #define SHIBSP_API SHIBSP_IMPORT
64 #endif
65
66 // Throwable classes must always be visible on GCC in all binaries
67 #ifdef WIN32
68   #define SHIBSP_EXCEPTIONAPI(api) api
69 #elif defined(GCC_HASCLASSVISIBILITY)
70   #define SHIBSP_EXCEPTIONAPI(api) SHIBSP_EXPORT
71 #else
72   #define SHIBSP_EXCEPTIONAPI(api)
73 #endif
74
75 #ifdef WIN32
76
77 /** Default catalog path on Windows. */
78 # define SHIBSP_SCHEMAS "c:/opt/shibboleth-sp/share/xml/xmltooling/catalog.xml;c:/opt/shibboleth-sp/share/xml/opensaml/saml20-catalog.xml;c:/opt/shibboleth-sp/share/xml/opensaml/saml11-catalog.xml;c:/opt/shibboleth-sp/share/xml/shibboleth/catalog.xml"
79
80 /** Default name of configuration file on Windows. */
81 # define SHIBSP_CONFIG "shibboleth2.xml"
82
83 /**
84  * Controls default logging level of console tools and other situations
85  * where fully-configured logging isn't used.
86  */
87 #define SHIBSP_LOGGING "console.logger"
88
89 /** Default prefix for installation (used to resolve relative paths). */
90 #define SHIBSP_PREFIX  "c:/opt/shibboleth-sp"
91
92 /** Library directory for installation (used to resolve relative paths). */
93 #define SHIBSP_LIBDIR  "lib"
94
95 /** Log directory for installation (used to resolve relative paths). */
96 #define SHIBSP_LOGDIR  "var/log"
97
98 /** Configuration directory for installation (used to resolve relative paths). */
99 #define SHIBSP_CFGDIR  "etc"
100
101 /** Runtime state directory for installation (used to resolve relative paths). */
102 #define SHIBSP_RUNDIR  "var/run"
103
104 /** XML directory for installation (used to resolve relative paths). */
105 #define SHIBSP_XMLDIR  "share/xml"
106
107 #else
108 # include <shibsp/paths.h>
109 #endif
110
111 /** Logging category for Service Provider functions. */
112 #define SHIBSP_LOGCAT "Shibboleth"
113
114 /** Logging category for Service Provider auditing. */
115 #define SHIBSP_TX_LOGCAT "Shibboleth-TRANSACTION"
116
117 #endif /* __shibsp_base_h__ */