xref: /xnu-10063.121.3/SETUP/config/config.h (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1*2c2f96dcSApple OSS Distributions /*
2*2c2f96dcSApple OSS Distributions  * Copyright (c) 1999-2009 Apple Inc. All rights reserved.
3*2c2f96dcSApple OSS Distributions  *
4*2c2f96dcSApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*2c2f96dcSApple OSS Distributions  *
6*2c2f96dcSApple OSS Distributions  * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
7*2c2f96dcSApple OSS Distributions  * Reserved.  This file contains Original Code and/or Modifications of
8*2c2f96dcSApple OSS Distributions  * Original Code as defined in and that are subject to the Apple Public
9*2c2f96dcSApple OSS Distributions  * Source License Version 1.0 (the 'License').  You may not use this file
10*2c2f96dcSApple OSS Distributions  * except in compliance with the License.  Please obtain a copy of the
11*2c2f96dcSApple OSS Distributions  * License at http://www.apple.com/publicsource and read it before using
12*2c2f96dcSApple OSS Distributions  * this file.
13*2c2f96dcSApple OSS Distributions  *
14*2c2f96dcSApple OSS Distributions  * The Original Code and all software distributed under the License are
15*2c2f96dcSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16*2c2f96dcSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17*2c2f96dcSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18*2c2f96dcSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
19*2c2f96dcSApple OSS Distributions  * License for the specific language governing rights and limitations
20*2c2f96dcSApple OSS Distributions  * under the License."
21*2c2f96dcSApple OSS Distributions  *
22*2c2f96dcSApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
23*2c2f96dcSApple OSS Distributions  */
24*2c2f96dcSApple OSS Distributions /*
25*2c2f96dcSApple OSS Distributions  * Mach Operating System
26*2c2f96dcSApple OSS Distributions  * Copyright (c) 1990 Carnegie-Mellon University
27*2c2f96dcSApple OSS Distributions  * Copyright (c) 1989 Carnegie-Mellon University
28*2c2f96dcSApple OSS Distributions  * Copyright (c) 1988 Carnegie-Mellon University
29*2c2f96dcSApple OSS Distributions  * Copyright (c) 1987 Carnegie-Mellon University
30*2c2f96dcSApple OSS Distributions  * All rights reserved.  The CMU software License Agreement specifies
31*2c2f96dcSApple OSS Distributions  * the terms and conditions for use and redistribution.
32*2c2f96dcSApple OSS Distributions  */
33*2c2f96dcSApple OSS Distributions 
34*2c2f96dcSApple OSS Distributions /*
35*2c2f96dcSApple OSS Distributions  * Copyright (c) 1980 Regents of the University of California.
36*2c2f96dcSApple OSS Distributions  * All rights reserved.
37*2c2f96dcSApple OSS Distributions  *
38*2c2f96dcSApple OSS Distributions  * Redistribution and use in source and binary forms are permitted
39*2c2f96dcSApple OSS Distributions  * provided that the above copyright notice and this paragraph are
40*2c2f96dcSApple OSS Distributions  * duplicated in all such forms and that any documentation,
41*2c2f96dcSApple OSS Distributions  * advertising materials, and other materials related to such
42*2c2f96dcSApple OSS Distributions  * distribution and use acknowledge that the software was developed
43*2c2f96dcSApple OSS Distributions  * by the University of California, Berkeley.  The name of the
44*2c2f96dcSApple OSS Distributions  * University may not be used to endorse or promote products derived
45*2c2f96dcSApple OSS Distributions  * from this software without specific prior written permission.
46*2c2f96dcSApple OSS Distributions  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
47*2c2f96dcSApple OSS Distributions  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
48*2c2f96dcSApple OSS Distributions  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
49*2c2f96dcSApple OSS Distributions  *
50*2c2f96dcSApple OSS Distributions  *	@(#)config.h	5.8 (Berkeley) 6/18/88
51*2c2f96dcSApple OSS Distributions  */
52*2c2f96dcSApple OSS Distributions 
53*2c2f96dcSApple OSS Distributions /*
54*2c2f96dcSApple OSS Distributions  * Config.
55*2c2f96dcSApple OSS Distributions  */
56*2c2f96dcSApple OSS Distributions 
57*2c2f96dcSApple OSS Distributions #include <stdio.h>
58*2c2f96dcSApple OSS Distributions #include <sys/types.h>
59*2c2f96dcSApple OSS Distributions #include <sys/param.h>
60*2c2f96dcSApple OSS Distributions #include <stdlib.h>
61*2c2f96dcSApple OSS Distributions #include <string.h>
62*2c2f96dcSApple OSS Distributions 
63*2c2f96dcSApple OSS Distributions struct file_list {
64*2c2f96dcSApple OSS Distributions 	struct  file_list *f_next;
65*2c2f96dcSApple OSS Distributions 	char    *f_fn;                  /* the name */
66*2c2f96dcSApple OSS Distributions 	u_char  f_type;                 /* see below */
67*2c2f96dcSApple OSS Distributions 	u_char  f_flags;                /* see below */
68*2c2f96dcSApple OSS Distributions 	short   f_special;              /* requires special make rule */
69*2c2f96dcSApple OSS Distributions 	char    *f_needs;
70*2c2f96dcSApple OSS Distributions 	char    *f_extra;               /* stuff to add to make line */
71*2c2f96dcSApple OSS Distributions };
72*2c2f96dcSApple OSS Distributions 
73*2c2f96dcSApple OSS Distributions /*
74*2c2f96dcSApple OSS Distributions  * Types.
75*2c2f96dcSApple OSS Distributions  */
76*2c2f96dcSApple OSS Distributions #define DRIVER          1
77*2c2f96dcSApple OSS Distributions #define NORMAL          2
78*2c2f96dcSApple OSS Distributions #define INVISIBLE       3
79*2c2f96dcSApple OSS Distributions #define PROFILING       4
80*2c2f96dcSApple OSS Distributions 
81*2c2f96dcSApple OSS Distributions /*
82*2c2f96dcSApple OSS Distributions  * Attributes (flags).
83*2c2f96dcSApple OSS Distributions  */
84*2c2f96dcSApple OSS Distributions #define CONFIGDEP            0x01    /* obsolete? */
85*2c2f96dcSApple OSS Distributions #define OPTIONSDEF           0x02    /* options definition entry */
86*2c2f96dcSApple OSS Distributions #define LIBRARYDEP           0x04    /* include file in library build */
87*2c2f96dcSApple OSS Distributions #define BOUND_CHECKS         0x08    /* build with -fbounds-safety */
88*2c2f96dcSApple OSS Distributions #define BOUND_CHECKS_SOFT    0x10    /* emit non-panicking traps for bound-checked source */
89*2c2f96dcSApple OSS Distributions #define BOUND_CHECKS_DEBUG       0x20    /* emit one panicking trap per bounds check */
90*2c2f96dcSApple OSS Distributions 
91*2c2f96dcSApple OSS Distributions struct device {
92*2c2f96dcSApple OSS Distributions 	int     d_type;                 /* CONTROLLER, DEVICE, bus adaptor */
93*2c2f96dcSApple OSS Distributions 	const char      *d_name;        /* name of device (e.g. rk11) */
94*2c2f96dcSApple OSS Distributions 	int     d_slave;                /* slave number */
95*2c2f96dcSApple OSS Distributions #define QUES    -1      /* -1 means '?' */
96*2c2f96dcSApple OSS Distributions #define UNKNOWN -2      /* -2 means not set yet */
97*2c2f96dcSApple OSS Distributions 	int     d_flags;                /* nlags for device init */
98*2c2f96dcSApple OSS Distributions 	struct  device *d_next;         /* Next one in list */
99*2c2f96dcSApple OSS Distributions 	char    *d_init;                /* pseudo device init routine name */
100*2c2f96dcSApple OSS Distributions };
101*2c2f96dcSApple OSS Distributions 
102*2c2f96dcSApple OSS Distributions /*
103*2c2f96dcSApple OSS Distributions  * Config has a global notion of which machine type is
104*2c2f96dcSApple OSS Distributions  * being used.  It uses the name of the machine in choosing
105*2c2f96dcSApple OSS Distributions  * files and directories.  Thus if the name of the machine is ``vax'',
106*2c2f96dcSApple OSS Distributions  * it will build from ``Makefile.vax'' and use ``../vax/inline''
107*2c2f96dcSApple OSS Distributions  * in the makerules, etc.
108*2c2f96dcSApple OSS Distributions  */
109*2c2f96dcSApple OSS Distributions extern const char       *machinename;
110*2c2f96dcSApple OSS Distributions 
111*2c2f96dcSApple OSS Distributions /*
112*2c2f96dcSApple OSS Distributions  * In order to configure and build outside the kernel source tree,
113*2c2f96dcSApple OSS Distributions  * we may wish to specify where the source tree lives.
114*2c2f96dcSApple OSS Distributions  */
115*2c2f96dcSApple OSS Distributions extern const char *source_directory;
116*2c2f96dcSApple OSS Distributions extern const char *object_directory;
117*2c2f96dcSApple OSS Distributions extern char *config_directory;
118*2c2f96dcSApple OSS Distributions 
119*2c2f96dcSApple OSS Distributions FILE *fopenp(const char *fpath, char *file, char *complete, const char *ftype);
120*2c2f96dcSApple OSS Distributions const char *get_VPATH(void);
121*2c2f96dcSApple OSS Distributions #define VPATH   get_VPATH()
122*2c2f96dcSApple OSS Distributions 
123*2c2f96dcSApple OSS Distributions /*
124*2c2f96dcSApple OSS Distributions  * A set of options may also be specified which are like CPU types,
125*2c2f96dcSApple OSS Distributions  * but which may also specify values for the options.
126*2c2f96dcSApple OSS Distributions  * A separate set of options may be defined for make-style options.
127*2c2f96dcSApple OSS Distributions  */
128*2c2f96dcSApple OSS Distributions struct opt {
129*2c2f96dcSApple OSS Distributions 	char    *op_name;
130*2c2f96dcSApple OSS Distributions 	char    *op_value;
131*2c2f96dcSApple OSS Distributions 	struct  opt *op_next;
132*2c2f96dcSApple OSS Distributions };
133*2c2f96dcSApple OSS Distributions 
134*2c2f96dcSApple OSS Distributions extern struct opt *opt, *mkopt, *opt_tail, *mkopt_tail;
135*2c2f96dcSApple OSS Distributions 
136*2c2f96dcSApple OSS Distributions const char      *get_word(FILE *fp);
137*2c2f96dcSApple OSS Distributions char    *ns(const char *str);
138*2c2f96dcSApple OSS Distributions char    *qu(int num);
139*2c2f96dcSApple OSS Distributions char    *path(const char *file);
140*2c2f96dcSApple OSS Distributions 
141*2c2f96dcSApple OSS Distributions extern int      do_trace;
142*2c2f96dcSApple OSS Distributions 
143*2c2f96dcSApple OSS Distributions extern struct   device *dtab;
144*2c2f96dcSApple OSS Distributions dev_t   nametodev(char *name, int defunit, char defpartition);
145*2c2f96dcSApple OSS Distributions char    *devtoname(dev_t dev);
146*2c2f96dcSApple OSS Distributions 
147*2c2f96dcSApple OSS Distributions extern char     errbuf[80];
148*2c2f96dcSApple OSS Distributions extern int      yyline;
149*2c2f96dcSApple OSS Distributions 
150*2c2f96dcSApple OSS Distributions extern struct   file_list *ftab, *conf_list, **confp;
151*2c2f96dcSApple OSS Distributions extern char     *build_directory;
152*2c2f96dcSApple OSS Distributions 
153*2c2f96dcSApple OSS Distributions extern int      profiling;
154*2c2f96dcSApple OSS Distributions 
155*2c2f96dcSApple OSS Distributions #define eq(a, b) (!strcmp(a,b))
156*2c2f96dcSApple OSS Distributions 
157*2c2f96dcSApple OSS Distributions #define DEV_MASK 0x7
158*2c2f96dcSApple OSS Distributions #define DEV_SHIFT  3
159*2c2f96dcSApple OSS Distributions 
160*2c2f96dcSApple OSS Distributions /* External function references */
161*2c2f96dcSApple OSS Distributions char *get_rest(FILE *fp);
162*2c2f96dcSApple OSS Distributions 
163*2c2f96dcSApple OSS Distributions int yyparse(void);
164*2c2f96dcSApple OSS Distributions void yyerror(const char *s);
165*2c2f96dcSApple OSS Distributions 
166*2c2f96dcSApple OSS Distributions void mkioconf(void);
167*2c2f96dcSApple OSS Distributions 
168*2c2f96dcSApple OSS Distributions void makefile(void);
169*2c2f96dcSApple OSS Distributions void headers(void);
170*2c2f96dcSApple OSS Distributions int opteq(const char *cp, const char *dp);
171*2c2f96dcSApple OSS Distributions 
172*2c2f96dcSApple OSS Distributions void init_dev(struct device *dp);
173*2c2f96dcSApple OSS Distributions void newdev(struct device *dp);
174*2c2f96dcSApple OSS Distributions void dev_param(struct device *dp, const char *str, long num);
175*2c2f96dcSApple OSS Distributions 
176*2c2f96dcSApple OSS Distributions int searchp(const char *spath, char *file, char *fullname, int (*func)(char *));
177