added '-configure-pkg-config-var-' rule
[k8jam.git] / src / jam.h
blob7d01327e45d82730234ceb592519a218c50f246e
1 /*
2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
3 * This file is part of Jam - see jam.c for Copyright information.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * jam.h - includes and globals for jam
21 #ifndef JAMH_MAIN_H
22 #define JAMH_MAIN_H
24 #if defined(__GNUC__) && __GNUC__ > 2
25 # define JAMFA_PURE __attribute__((pure))
26 # define JAMFA_CONST __attribute__((const))
27 # define JAMFA_NORETURN __attribute__((noreturn))
28 # define JAMFA_PRINTF(m,n) __attribute__((format(printf, m, n)))
29 # define JAMFA_SENTINEL __attribute__((sentinel))
30 #else
31 # define JAMFA_PURE
32 # define JAMFA_CONST
33 # define JAMFA_NORETURN
34 # define JAMFA_PRINTF(m,n)
35 # define JAMFA_SENTINEL
36 #endif
39 /* Windows NT */
40 #ifdef NT
41 # include <fcntl.h>
42 # include <stdlib.h>
43 # include <stdio.h>
44 # include <ctype.h>
45 # include <malloc.h>
46 # include <memory.h>
47 # include <signal.h>
48 # include <string.h>
49 # include <time.h>
50 # define OSMAJOR "NT=true"
51 # define OSMINOR "OS=NT"
52 # define OS_NT
53 # define SPLITPATH ';'
54 # define MAXLINE 2046 /* longest 'together' actions */
55 /*# define USE_EXECNT*/
56 # define PATH_DELIM '\\'
57 # define DOWNSHIFT_PATHS
58 #endif
61 /* Windows MingW32 */
62 #ifdef MINGW
63 # include <fcntl.h>
64 # include <stdlib.h>
65 # include <stdio.h>
66 # include <ctype.h>
67 # include <malloc.h>
68 # include <memory.h>
69 # include <signal.h>
70 # include <string.h>
71 # include <time.h>
72 # define OSMAJOR "MINGW=true"
73 # define OSMINOR "OS=MINGW"
74 # define OS_NT
75 # define SPLITPATH ';'
76 # define MAXLINE 2046 /* longest 'together' actions */
77 # define PATH_DELIM '\\'
78 # define DOWNSHIFT_PATHS
79 #endif
82 /* God fearing UNIX */
83 #ifndef OSMINOR
84 # define OSMAJOR "UNIX=true"
85 # define USE_FILEUNIX
86 # define PATH_DELIM '/'
87 # ifdef __FreeBSD__
88 # define OSMINOR "OS=FREEBSD"
89 # define OS_FREEBSD
90 # endif
91 # ifdef linux
92 # define OSMINOR "OS=LINUX"
93 # define OS_LINUX
94 # endif
95 # ifdef __NetBSD__
96 # define unix
97 # define OSMINOR "OS=NETBSD"
98 # define OS_NETBSD
99 # define NO_VFORK
100 # endif
101 # ifdef __QNX__
102 # ifdef __QNXNTO__
103 # define OSMINOR "OS=QNXNTO"
104 # define OS_QNXNTO
105 # else
106 # define unix
107 # define OSMINOR "OS=QNX"
108 # define OS_QNX
109 # define NO_VFORK
110 # define MAXLINE 996
111 # endif
112 # endif
113 # ifdef __APPLE__
114 # define unix
115 # define OSMINOR "OS=MACOSX"
116 # define OS_MACOSX
117 # endif
118 # ifndef OSMINOR
119 # define OSMINOR "OS=UNKNOWN"
120 # endif
121 /* All the UNIX includes */
122 # include <sys/types.h>
123 # include <sys/stat.h>
124 # include <sys/file.h>
125 # include <fcntl.h>
126 # include <stdio.h>
127 # include <ctype.h>
128 # include <signal.h>
129 # include <string.h>
130 # include <time.h>
131 # ifndef OS_QNX
132 # include <memory.h>
133 # endif
134 # include <stdlib.h>
135 # if !defined(OS_FREEBSD) && !defined(OS_MACOSX)
136 # include <malloc.h>
137 # endif
138 # include <sys/types.h>
139 # include <sys/wait.h>
140 # include <unistd.h>
141 #endif
144 /* OSPLAT definitions - suppressed when it's a one-of-a-kind */
145 #if defined(_M_PPC) || \
146 defined(PPC) || \
147 defined(ppc) || \
148 defined(__powerpc__) || \
149 defined(__POWERPC__) || \
150 defined(__ppc__)
151 # define OSPLAT "OSPLAT=PPC"
152 #endif
154 #if defined(_i386_) || \
155 defined(__i386__) || \
156 defined(_M_IX86)
157 # if !defined(OS_FREEBSD)
158 # define OSPLAT "OSPLAT=X86"
159 # endif
160 #endif
162 #if defined(__x86_64__)
163 # ifdef OSPLAT
164 # undef OSPLAT
165 # endif
166 # define OSPLAT "OSPLAT=X86_64"
167 #endif
169 #ifdef __sparc__
170 # define OSPLAT "OSPLAT=SPARC"
171 #endif
173 #ifdef __mips__
174 # define OSPLAT "OSPLAT=MIPS"
175 #endif
177 #ifdef __arm__
178 # define OSPLAT "OSPLAT=ARM"
179 #endif
181 #if defined(__ia64__) || defined(__IA64__) || defined(_M_IA64)
182 # define OSPLAT "OSPLAT=IA64"
183 #endif
185 #ifdef __s390__
186 # define OSPLAT "OSPLAT=390"
187 #endif
189 #ifndef OSPLAT
190 # define OSPLAT ""
191 #endif
194 /* Jam implementation misc. */
195 /* longest 'together' actions' */
196 #ifndef MAXLINE
197 # define MAXLINE (10240)
198 #endif
200 #ifndef EXITOK
201 # define EXITOK (0)
202 # define EXITBAD (1)
203 #endif
205 #ifndef SPLITPATH
206 # define SPLITPATH ':'
207 #endif
210 /* You probably don't need to muck with these. */
211 #define MAXJPATH (8192) /* longest filename */
213 #define MAXJOBS (64) /* silently enforce -j limit */
214 #define MAXARGC (32) /* words in $(JAMSHELL) */
217 /* Jam private definitions below. */
218 #define DEBUG_MAX (16)
220 struct globs {
221 int noexec;
222 int jobs;
223 int quitquick;
224 int newestfirst; /* build newest sources first */
225 char debug[DEBUG_MAX];
226 FILE *cmdout; /* print cmds, not run them */
227 //#ifdef OPT_IMPROVED_PROGRESS_EXT
228 int updating; /* # targets we are updating */
229 void *progress; /* progress data (progress.h) */
230 //#endif
233 extern struct globs globs;
236 #define DEBUG_MAKE (globs.debug[1]) /* -da show actions when executed */
237 #define DEBUG_MAKEPROG (globs.debug[3]) /* -dm show progress of make0 */
239 #define DEBUG_EXECCMD (globs.debug[4]) /* show execcmds()'s work */
241 #define DEBUG_COMPILE (globs.debug[5]) /* show rule invocations */
243 #define DEBUG_HEADER (globs.debug[6]) /* show result of header scan */
244 #define DEBUG_BINDSCAN (globs.debug[6]) /* show result of dir scan */
245 #define DEBUG_SEARCH (globs.debug[6]) /* show attempts at binding */
247 #define DEBUG_VARSET (globs.debug[7]) /* show variable settings */
248 #define DEBUG_VARGET (globs.debug[8]) /* show variable fetches */
249 #define DEBUG_VAREXP (globs.debug[8]) /* show variable expansions */
250 #define DEBUG_IF (globs.debug[8]) /* show 'if' calculations */
251 #define DEBUG_LISTS (globs.debug[9]) /* show list manipulation */
252 #define DEBUG_MEM (globs.debug[9]) /* show memory use */
254 #define DEBUG_MAKEQ (globs.debug[11]) /* -da show even quiet actions */
255 #define DEBUG_EXEC (globs.debug[12]) /* -dx show text of actions */
256 #define DEBUG_DEPENDS (globs.debug[13]) /* -dd show dependency graph */
257 #define DEBUG_CAUSES (globs.debug[14]) /* -dc show dependency graph */
258 #define DEBUG_SCAN (globs.debug[15]) /* show scanner tokens */
261 extern void jambase_unpack (void);
264 #define JAM_OPT_SEMAPHORE
267 /******************************************************************************/
268 #include "re9.h"
271 typedef struct {
272 const char *restr; /* regexp string; DON'T DELETE, DON'T MOVE, DON'T CHANGE! */
273 re9_prog_t *re; /* compiled regexp */
274 int flags; /* flags for re9_execute() */
275 /*REGEXP9_DEBUG_MEMSIZE*/
276 int maxmem;
277 } regexp_t;
281 * regexp options:
282 * i: ignore case
283 * u: this is utf-8 string
284 * m: '.' matches newline
285 * default mode: non-utf-8 (it can be only reset with /.../u)
287 extern regexp_t *regexp_compile (const char *str, int flags);
288 extern int regexp_execute (regexp_t *re, const char *bol, re9_sub_t *mp, int ms);
289 extern void regexp_free (regexp_t *re);
290 extern void regexp_done (void);
293 #endif