summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/mkoptions.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-07-13 04:08:08 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-07-13 04:08:08 +0000
commitb340f08eda23ed6e1cfb16525af6986de6c36055 (patch)
tree209e7f9f2191555e438e8dae59aad689b0ac3a39 /usr.sbin/config/mkoptions.c
parent36d55e82a5b7a2c8a8fb0854d402d69e4c23c942 (diff)
downloadFreeBSD-src-b340f08eda23ed6e1cfb16525af6986de6c36055.zip
FreeBSD-src-b340f08eda23ed6e1cfb16525af6986de6c36055.tar.gz
Enhance config to handle MACHINEs with multiple architectures:
- Passing -m to config will now print the MACHINE and MACHINE_ARCH given in the passed kernel configuration file and then exit. - If an option is defined in options.MACHINE with the same name as the architecture of the kernel being configured, that option will be considered set. This allows conditional compilation based on CPU architecture. Config version is now 600010. Reviewed by: imp
Diffstat (limited to 'usr.sbin/config/mkoptions.c')
-rw-r--r--usr.sbin/config/mkoptions.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c
index 044b669..2992ec3 100644
--- a/usr.sbin/config/mkoptions.c
+++ b/usr.sbin/config/mkoptions.c
@@ -94,6 +94,20 @@ options(void)
SLIST_INSERT_HEAD(&opt, op, op_next);
read_options();
+
+ /* Fake the value of MACHINE_ARCH as an option if necessary */
+ SLIST_FOREACH(ol, &otab, o_next) {
+ if (strcasecmp(ol->o_name, machinearch) != 0)
+ continue;
+
+ op = (struct opt *)calloc(1, sizeof(*op));
+ if (op == NULL)
+ err(EXIT_FAILURE, "calloc");
+ op->op_name = ns(ol->o_name);
+ SLIST_INSERT_HEAD(&opt, op, op_next);
+ break;
+ }
+
SLIST_FOREACH(op, &opt, op_next) {
SLIST_FOREACH(ol, &otab, o_next) {
if (eq(op->op_name, ol->o_name) &&
OpenPOWER on IntegriCloud