comparison libinterp/corefcn/toplev.cc @ 21253:a66a737913b5

allow __have_feature__ to check for ENABLE_ options * __have_feature__.m: Handle ENABLE_ options. * mex_demo.c, oct_demo.cc: Update note about octave_config_info. * toplev.cc (Foctave_config_info): For ENABLE_ options, store logical values instead of true/false or yes/no strings in struct. * computer.m: Change use of octave_config_info ("ENABLE_64").
author John W. Eaton <jwe@octave.org>
date Fri, 12 Feb 2016 16:28:51 -0500
parents a83e7a384ee0
children 40de9f8f23a6
comparison
equal deleted inserted replaced
21252:b2ec3a699ad7 21253:a66a737913b5
1264 1264
1265 static bool initialized = false; 1265 static bool initialized = false;
1266 1266
1267 struct conf_info_struct 1267 struct conf_info_struct
1268 { 1268 {
1269 bool subst_home;
1270 const char *key; 1269 const char *key;
1271 const char *val; 1270 octave_value val;
1272 }; 1271 };
1273 1272
1274 static const conf_info_struct conf_info[] = 1273 static const conf_info_struct conf_info[] =
1275 { 1274 {
1276 { false, "DEFAULT_PAGER", OCTAVE_DEFAULT_PAGER }, 1275 { "DEFAULT_PAGER", OCTAVE_DEFAULT_PAGER },
1277 1276
1278 #if defined (OCTAVE_ENABLE_64) 1277 #if defined (OCTAVE_ENABLE_64)
1279 { false, "ENABLE_64", "yes" }, 1278 { "ENABLE_64", true },
1280 #else 1279 #else
1281 { false, "ENABLE_64", "no" }, 1280 { "ENABLE_64", false },
1282 #endif 1281 #endif
1283 1282
1284 #if defined (OCTAVE_ENABLE_ATOMIC_REFCOUNT) 1283 #if defined (OCTAVE_ENABLE_ATOMIC_REFCOUNT)
1285 { false, "ENABLE_ATOMIC_REFCOUNT", "yes" }, 1284 { "ENABLE_ATOMIC_REFCOUNT", true },
1286 #else 1285 #else
1287 { false, "ENABLE_ATOMIC_REFCOUNT", "no" }, 1286 { "ENABLE_ATOMIC_REFCOUNT", false },
1288 #endif 1287 #endif
1289 1288
1290 #if defined (OCTAVE_ENABLE_BOUNDS_CHECK) 1289 #if defined (OCTAVE_ENABLE_BOUNDS_CHECK)
1291 { false, "ENABLE_BOUNDS_CHECK", "yes" }, 1290 { "ENABLE_BOUNDS_CHECK", true },
1292 #else 1291 #else
1293 { false, "ENABLE_BOUNDS_CHECK", "no" }, 1292 { "ENABLE_BOUNDS_CHECK", false },
1294 #endif 1293 #endif
1295 1294
1296 #if defined (ENABLE_DOCS) 1295 #if defined (ENABLE_DOCS)
1297 { false, "ENABLE_DOCS", "yes" }, 1296 { "ENABLE_DOCS", true },
1298 #else 1297 #else
1299 { false, "ENABLE_DOCS", "no" }, 1298 { "ENABLE_DOCS", false },
1300 #endif 1299 #endif
1301 1300
1302 #if defined (ENABLE_DYNAMIC_LINKING) 1301 #if defined (ENABLE_DYNAMIC_LINKING)
1303 { false, "ENABLE_DYNAMIC_LINKING", "yes" }, 1302 { "ENABLE_DYNAMIC_LINKING", true },
1304 #else 1303 #else
1305 { false, "ENABLE_DYNAMIC_LINKING", "no" }, 1304 { "ENABLE_DYNAMIC_LINKING", false },
1306 #endif 1305 #endif
1307 1306
1308 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE) 1307 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE)
1309 { false, "ENABLE_FLOAT_TRUNCATE", "yes" }, 1308 { "ENABLE_FLOAT_TRUNCATE", true },
1310 #else 1309 #else
1311 { false, "ENABLE_FLOAT_TRUNCATE", "no" }, 1310 { "ENABLE_FLOAT_TRUNCATE", false },
1312 #endif 1311 #endif
1313 1312
1314 #if defined (ENABLE_JIT) 1313 #if defined (ENABLE_JIT)
1315 { false, "ENABLE_JIT", "yes" }, 1314 { "ENABLE_JIT", true },
1316 #else 1315 #else
1317 { false, "ENABLE_JIT", "no" }, 1316 { "ENABLE_JIT", false },
1318 #endif 1317 #endif
1319 1318
1320 #if defined (OCTAVE_ENABLE_OPENMP) 1319 #if defined (OCTAVE_ENABLE_OPENMP)
1321 { false, "ENABLE_OPENMP", "yes" }, 1320 { "ENABLE_OPENMP", true },
1322 #else 1321 #else
1323 { false, "ENABLE_OPENMP", "no" }, 1322 { "ENABLE_OPENMP", false },
1324 #endif 1323 #endif
1325 1324
1326 { false, "api_version", OCTAVE_API_VERSION }, 1325 { "api_version", OCTAVE_API_VERSION },
1327 { true, "archlibdir", OCTAVE_ARCHLIBDIR }, 1326 { "archlibdir", subst_octave_home (OCTAVE_ARCHLIBDIR) },
1328 { true, "bindir", OCTAVE_BINDIR }, 1327 { "bindir", subst_octave_home (OCTAVE_BINDIR) },
1329 { false, "canonical_host_type", OCTAVE_CANONICAL_HOST_TYPE }, 1328 { "canonical_host_type", OCTAVE_CANONICAL_HOST_TYPE },
1330 { true, "datadir", OCTAVE_DATADIR }, 1329 { "datadir", subst_octave_home (OCTAVE_DATADIR) },
1331 { true, "datarootdir", OCTAVE_DATAROOTDIR }, 1330 { "datarootdir", subst_octave_home (OCTAVE_DATAROOTDIR) },
1332 { true, "exec_prefix", OCTAVE_EXEC_PREFIX }, 1331 { "exec_prefix", subst_octave_home (OCTAVE_EXEC_PREFIX) },
1333 { true, "fcnfiledir", OCTAVE_FCNFILEDIR }, 1332 { "fcnfiledir", subst_octave_home (OCTAVE_FCNFILEDIR) },
1334 { true, "imagedir", OCTAVE_IMAGEDIR }, 1333 { "imagedir", subst_octave_home (OCTAVE_IMAGEDIR) },
1335 { true, "includedir", OCTAVE_INCLUDEDIR }, 1334 { "includedir", subst_octave_home (OCTAVE_INCLUDEDIR) },
1336 { true, "infodir", OCTAVE_INFODIR }, 1335 { "infodir", subst_octave_home (OCTAVE_INFODIR) },
1337 { true, "infofile", OCTAVE_INFOFILE }, 1336 { "infofile", subst_octave_home (OCTAVE_INFOFILE) },
1338 { true, "libdir", OCTAVE_LIBDIR }, 1337 { "libdir", subst_octave_home (OCTAVE_LIBDIR) },
1339 { true, "libexecdir", OCTAVE_LIBEXECDIR }, 1338 { "libexecdir", subst_octave_home (OCTAVE_LIBEXECDIR) },
1340 { true, "localapiarchlibdir", OCTAVE_LOCALAPIARCHLIBDIR }, 1339 { "localapiarchlibdir", subst_octave_home (OCTAVE_LOCALAPIARCHLIBDIR) },
1341 { true, "localapifcnfiledir", OCTAVE_LOCALAPIFCNFILEDIR }, 1340 { "localapifcnfiledir", subst_octave_home (OCTAVE_LOCALAPIFCNFILEDIR) },
1342 { true, "localapioctfiledir", OCTAVE_LOCALAPIOCTFILEDIR }, 1341 { "localapioctfiledir", subst_octave_home (OCTAVE_LOCALAPIOCTFILEDIR) },
1343 { true, "localarchlibdir", OCTAVE_LOCALARCHLIBDIR }, 1342 { "localarchlibdir", subst_octave_home (OCTAVE_LOCALARCHLIBDIR) },
1344 { true, "localfcnfiledir", OCTAVE_LOCALFCNFILEDIR }, 1343 { "localfcnfiledir", subst_octave_home (OCTAVE_LOCALFCNFILEDIR) },
1345 { true, "localoctfiledir", OCTAVE_LOCALOCTFILEDIR }, 1344 { "localoctfiledir", subst_octave_home (OCTAVE_LOCALOCTFILEDIR) },
1346 { true, "localstartupfiledir", OCTAVE_LOCALSTARTUPFILEDIR }, 1345 { "localstartupfiledir", subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR) },
1347 { true, "localverarchlibdir", OCTAVE_LOCALVERARCHLIBDIR }, 1346 { "localverarchlibdir", subst_octave_home (OCTAVE_LOCALVERARCHLIBDIR) },
1348 { true, "localverfcnfiledir", OCTAVE_LOCALVERFCNFILEDIR }, 1347 { "localverfcnfiledir", subst_octave_home (OCTAVE_LOCALVERFCNFILEDIR) },
1349 { true, "localveroctfiledir", OCTAVE_LOCALVEROCTFILEDIR }, 1348 { "localveroctfiledir", subst_octave_home (OCTAVE_LOCALVEROCTFILEDIR) },
1350 { true, "man1dir", OCTAVE_MAN1DIR }, 1349 { "man1dir", subst_octave_home (OCTAVE_MAN1DIR) },
1351 { false, "man1ext", OCTAVE_MAN1EXT }, 1350 { "man1ext", OCTAVE_MAN1EXT },
1352 { true, "mandir", OCTAVE_MANDIR }, 1351 { "mandir", subst_octave_home (OCTAVE_MANDIR) },
1353 { true, "octdatadir", OCTAVE_OCTDATADIR }, 1352 { "octdatadir", subst_octave_home (OCTAVE_OCTDATADIR) },
1354 { true, "octfiledir", OCTAVE_OCTFILEDIR }, 1353 { "octfiledir", subst_octave_home (OCTAVE_OCTFILEDIR) },
1355 { true, "octetcdir", OCTAVE_OCTETCDIR }, 1354 { "octetcdir", subst_octave_home (OCTAVE_OCTETCDIR) },
1356 { true, "octincludedir", OCTAVE_OCTINCLUDEDIR }, 1355 { "octincludedir", subst_octave_home (OCTAVE_OCTINCLUDEDIR) },
1357 { true, "octlibdir", OCTAVE_OCTLIBDIR }, 1356 { "octlibdir", subst_octave_home (OCTAVE_OCTLIBDIR) },
1358 { true, "octtestsdir", OCTAVE_OCTTESTSDIR }, 1357 { "octtestsdir", subst_octave_home (OCTAVE_OCTTESTSDIR) },
1359 { true, "prefix", OCTAVE_PREFIX }, 1358 { "prefix", subst_octave_home (OCTAVE_PREFIX) },
1360 { true, "startupfiledir", OCTAVE_STARTUPFILEDIR }, 1359 { "startupfiledir", subst_octave_home (OCTAVE_STARTUPFILEDIR) },
1361 { false, "version", OCTAVE_VERSION }, 1360 { "version", OCTAVE_VERSION },
1362 { false, 0, 0 } 1361 { 0, octave_value () }
1363 }; 1362 };
1364 1363
1365 struct build_info_struct 1364 struct build_info_struct
1366 { 1365 {
1367 const char *key; 1366 const char *key;
1542 const conf_info_struct& elt = conf_info[i++]; 1541 const conf_info_struct& elt = conf_info[i++];
1543 1542
1544 const char *key = elt.key; 1543 const char *key = elt.key;
1545 1544
1546 if (key) 1545 if (key)
1547 { 1546 config.assign (key, elt.val);
1548 if (elt.subst_home)
1549 config.assign (key, subst_octave_home (elt.val));
1550 else
1551 config.assign (key, elt.val);
1552 }
1553 else 1547 else
1554 break; 1548 break;
1555 } 1549 }
1556 1550
1557 bool unix_system = true; 1551 bool unix_system = true;