Index: trunk/scconfig/librnd/scconfig/rnd_hook_detect.h =================================================================== --- trunk/scconfig/librnd/scconfig/rnd_hook_detect.h (revision 32153) +++ trunk/scconfig/librnd/scconfig/rnd_hook_detect.h (nonexistent) @@ -1,353 +0,0 @@ -extern int want_coord_bits; - - /* figure coordinate bits */ -static void rnd_hook_detect_coord_bits(void) -{ - int int_bits = safe_atoi(get("sys/types/size/signed_int")) * 8; - int long_bits = safe_atoi(get("sys/types/size/signed_long_int")) * 8; - int long_long_bits = safe_atoi(get("sys/types/size/signed_long_long_int")) * 8; - int int64_bits = safe_atoi(get("sys/types/size/uint64_t")) * 8; - const char *chosen, *postfix; - char tmp[64]; - int need_stdint = 0; - - if (want_coord_bits == int_bits) { postfix="U"; chosen = "int"; } - else if (want_coord_bits == long_bits) { postfix="UL"; chosen = "long int"; } - else if (want_coord_bits == int64_bits) { postfix="ULL"; chosen = "int64_t"; need_stdint = 1; } - else if (want_coord_bits == long_long_bits) { postfix="ULL"; chosen = "long long int"; } - else { - report("ERROR: can't find a suitable integer type for coord to be %d bits wide\n", want_coord_bits); - exit(1); - } - - sprintf(tmp, "((1%s<<%d)-1)", postfix, want_coord_bits - 1); - put("/local/pcb/coord_type", chosen); - put("/local/pcb/coord_max", tmp); - - chosen = NULL; - if (istrue(get("/local/pcb/debug"))) { /* debug: c89 */ - if (int64_bits >= 64) { - /* to suppress warnings on systems that support c99 but are forced to compile in c89 mode */ - chosen = "int64_t"; - need_stdint = 1; - } - } - - if (chosen == NULL) { /* non-debug, thus non-c89 */ - if (long_long_bits >= 64) chosen = "long long int"; - else if (long_bits >= 64) chosen = "long int"; - else chosen = "double"; - } - put("/local/pcb/long64", chosen); - if (need_stdint) - put("/local/pcb/include_stdint", "#include "); -} - -static void rnd_hook_detect_cc(void) -{ - int need_inl = 0; - const char *host_ansi, *host_ped, *target_ansi, *target_ped, *target_pg, *target_no_pie; - const char *tmp, *fpic, *debug; - - require("cc/fpic", 0, 0); - host_ansi = get("/host/cc/argstd/ansi"); - host_ped = get("/host/cc/argstd/pedantic"); - target_ansi = get("/target/cc/argstd/ansi"); - target_ped = get("/target/cc/argstd/pedantic"); - target_pg = get("/target/cc/argstd/pg"); - target_no_pie = get("/target/cc/argstd/no-pie"); - require("cc/pragma_message", 0, 0); - require("fstools/ar", 0, 1); - - /* need to set debug flags here to make sure libs are detected with the modified cflags; -ansi matters in what #defines we need for some #includes */ - fpic = get("/target/cc/fpic"); - if (fpic == NULL) fpic = ""; - debug = get("/arg/debug"); - if (debug == NULL) debug = ""; - tmp = str_concat(" ", fpic, debug, NULL); - put("/local/global_cflags", tmp); - - /* for --debug mode, use -ansi -pedantic for all detection */ - put("/local/cc_flags_save", get("/target/cc/cflags")); - if (istrue(get("/local/pcb/debug"))) { - append("/target/cc/cflags", " "); - append("/target/cc/cflags", target_ansi); - append("/target/cc/cflags", " "); - append("/target/cc/cflags", target_ped); - } - if (istrue(get("/local/pcb/profile"))) { - append("/target/cc/cflags", " "); - append("/target/cc/cflags", target_pg); - append("/target/cc/cflags", " "); - append("/target/cc/cflags", target_no_pie); - } - - /* set cflags for C89 */ - put("/local/pcb/c89flags", ""); - if (istrue(get("/local/pcb/debug"))) { - - if ((target_ansi != NULL) && (*target_ansi != '\0')) { - append("/local/pcb/c89flags", " "); - append("/local/pcb/c89flags", target_ansi); - need_inl = 1; - } - if ((target_ped != NULL) && (*target_ped != '\0')) { - append("/local/pcb/c89flags", " "); - append("/local/pcb/c89flags", target_ped); - need_inl = 1; - } - } - - if (istrue(get("/local/pcb/profile"))) { - append("/local/pcb/cflags_profile", " "); - append("/local/pcb/cflags_profile", target_pg); - append("/local/pcb/cflags_profile", " "); - append("/local/pcb/cflags_profile", target_no_pie); - } - - if (!istrue(get("cc/inline"))) - need_inl = 1; - - if (need_inl) { - /* disable inline for C89 */ - append("/local/pcb/c89flags", " "); - append("/local/pcb/c89flags", "-Dinline= "); - } -} - -static int rnd_hook_detect_sys(void) -{ - int can_live_without_dynlib = 0; /* special optional exception for windows cross compilation for now */ - - if (istrue(get("/target/pcb/can_live_without_dynlib"))) - can_live_without_dynlib = 1; - - pup_hook_detect_target(); - - require("signal/names/*", 0, 0); - require("libs/env/setenv/*", 0, 0); - if (!istrue(get("libs/env/setenv/presents"))) - require("libs/env/putenv/*", 0, 0); - require("libs/fs/mkdtemp/*", 0, 0); - require("libs/fs/realpath/*", 0, 0); - require("libs/fs/readdir/*", 0, 1); - require("libs/io/fileno/*", 0, 1); - require("libs/io/popen/*", 0, 1); - require("libs/math/rint/*", 0, 0); - require("libs/math/round/*", 0, 0); - require("libs/userpass/getpwuid/*", 0, 0); - require("libs/script/fungw/*", 0, 0); - - if (istrue(get("libs/script/fungw/presents"))) { - require("libs/script/fungw/user_call_ctx/*", 0, 0); - if (!istrue(get("libs/script/fungw/user_call_ctx/presents"))) { - put("libs/script/fungw/presents", sfalse); - report_repeat("\nWARNING: system installed fungw is too old, can not use it, please install a newer version (falling back to minimal fungw shipped with pcb-rnd).\n\n"); - } - } - - if (!istrue(get("libs/script/fungw/presents"))) - fungw_hook_detect_target(); - - { - int miss_select = require("libs/socket/select/*", 0, 0); - if (require("libs/time/usleep/*", 0, 0) && require("libs/time/Sleep/*", 0, 0) && miss_select) { - report_repeat("\nERROR: can not find usleep() or Sleep() or select() - no idea how to sleep ms.\n\n"); - return 1; - } - } - - require("libs/time/gettimeofday/*", 0, 1); - - if (require("libs/ldl", 0, 0) != 0) { - if (require("libs/LoadLibrary", 0, 0) != 0) { - if (can_live_without_dynlib) { - report_repeat("\nWARNING: no dynamic linking found on your system. Dynamic plugin loading will fail.\n\n"); - } - else { - report_repeat("\nERROR: no dynamic linking found on your system. Can not compile pcb-rnd.\n\n"); - return 1; - } - } - } - - if (require("libs/proc/wait", 0, 0) != 0) { - if (require("libs/proc/_spawnvp", 0, 0) != 0) { - report_repeat("\nERROR: no fork or _spawnvp. Can not compile pcb-rnd.\n\n"); - return 1; - } - } - - if (require("libs/fs/_mkdir", 0, 0) != 0) { - if (require("libs/fs/mkdir", 0, 0) != 0) { - report_repeat("\nERROR: no mkdir() or _mkdir(). Can not compile pcb-rnd.\n\n"); - return 1; - } - } - - if (require("libs/fs/getcwd/*", 0, 0) != 0) { - if (require("libs/fs/_getcwd/*", 0, 0) != 0) { - if (require("libs/fs/getwd/*", 0, 0) != 0) { - report_repeat("\nERROR: Can not find any getcwd() variant.\n\n"); - return 1; - } - } - } - - if (!istrue(get("libs/script/fungw/presents"))) { - if (plug_is_enabled("script")) - report_repeat("WARNING: Since there's no suitable system-installed fungw, only limited scripting is available using libfawk - if you need more scripting languages, install fungw and reconfigure.\n"); - put("/local/pcb/fungw_system", sfalse); - } - else - put("/local/pcb/fungw_system", strue); - - /* generic utils for Makefiles */ - require("sys/ext_exe", 0, 1); - require("sys/sysid", 0, 1); - - /* options for config.h */ - require("sys/path_sep", 0, 1); - require("sys/types/size/*", 0, 1); - require("cc/rdynamic", 0, 0); - require("cc/soname", 0, 0); - require("cc/so_undefined", 0, 0); - require("libs/snprintf", 0, 0); - require("libs/vsnprintf", 0, 0); - require("libs/fs/getcwd", 0, 0); - require("libs/fs/stat/macros/*", 0, 0); - - if (get("cc/rdynamic") == NULL) - put("cc/rdynamic", ""); - - return 0; -} - - -static void rnd_hook_detect_hid(int want_glib) -{ - int need_gtklibs = 0, want_gtk, want_gtk2, has_gtk2 = 0, want_gl; - - want_gtk2 = plug_is_enabled("hid_gtk2_gdk") || plug_is_enabled("hid_gtk2_gl"); - want_gtk = want_gtk2; /* plus |gtkN */ - - if (want_gtk2) { - require("libs/gui/gtk2/presents", 0, 0); - if (istrue(get("libs/gui/gtk2/presents"))) { - require("libs/gui/gtk2/key_prefix", 0, 1); - require("libs/gui/gtk2gl/presents", 0, 0); - if (!istrue(get("libs/gui/gtk2gl/presents"))) { - report_repeat("WARNING: Since there's no gl support for gtk found, disabling the gl rendering...\n"); - hook_custom_arg("disable-hid_gtk2_gl", NULL); - } - need_gtklibs = 1; - has_gtk2 = 1; - } - else { - report_repeat("WARNING: Since there's no libgtk2 found, disabling hid_gtk2*...\n"); - hook_custom_arg("disable-hid_gtk2_gdk", NULL); - hook_custom_arg("disable-hid_gtk2_gl", NULL); - } - } - - want_gl = plug_is_enabled("hid_gtk2_gl"); - if (want_gl) { - require("libs/gui/glu/presents", 0, 0); - if (!istrue(get("libs/gui/glu/presents"))) { - report_repeat("WARNING: Since there's no GLU found, disabling the hid_gtk2_gl plugin...\n"); - goto disable_gl; - } - else - put("/local/pcb/has_glu", strue); - } - else { - disable_gl:; - hook_custom_arg("disable-lib_hid_gl", NULL); - hook_custom_arg("disable-hid_gtk2_gl", NULL); - } - - /* libs/gui/gtkx is the version-independent set of flags in the XOR model */ - if (has_gtk2) { - put("/target/libs/gui/gtkx/cflags", get("/target/libs/gui/gtk2/cflags")); - put("/target/libs/gui/gtkx/ldflags", get("/target/libs/gui/gtk2/ldflags")); - } - - if (!need_gtklibs) { - report("No gtk support available, disabling lib_gtk_common...\n"); - hook_custom_arg("disable-lib_gtk_common", NULL); - } - - if (plug_is_enabled("hid_lesstif")) { - require("libs/gui/lesstif2/presents", 0, 0); - if (istrue(get("libs/gui/lesstif2/presents"))) { - require("libs/gui/xinerama/presents", 0, 0); - require("libs/gui/xrender/presents", 0, 0); - } - else { - report_repeat("WARNING: Since there's no lesstif2 found, disabling the lesstif HID and xinerama and xrender...\n"); - hook_custom_arg("disable-xinerama", NULL); - hook_custom_arg("disable-xrender", NULL); - hook_custom_arg("disable-hid_lesstif", NULL); - } - } - else { - hook_custom_arg("disable-xinerama", NULL); - hook_custom_arg("disable-xrender", NULL); - } - - if (want_gtk) - want_glib = 1; - - if (want_glib) { - require("libs/sul/glib", 0, 0); - if (!istrue(get("libs/sul/glib/presents"))) { - if (want_gtk) { - report_repeat("WARNING: Since GLIB is not found, disabling the GTK HID...\n"); - hook_custom_arg("disable-hid_gtk2_gdk", NULL); - hook_custom_arg("disable-hid_gtk2_gl", NULL); - } - if (plug_is_enabled("puller")) { - report_repeat("WARNING: Since GLIB is not found, disabling the puller...\n"); - hook_custom_arg("disable-puller", NULL); - } - } - } - else { - report("No need for glib, skipping GLIB detection\n"); - put("libs/sul/glib/presents", "false"); - put("libs/sul/glib/cflags", ""); - put("libs/sul/glib/ldflags", ""); - } - - if (!istrue(get("libs/sul/glib/presents"))) { - /* Makefile templates will still reference these variables, they should be empty */ - put("libs/sul/glib/cflags", ""); - put("libs/sul/glib/ldflags", ""); - } - -} - - -static int rnd_hook_detect_host(void) -{ - pup_hook_detect_host(); - fungw_hook_detect_host(); - - require("fstools/ar", 0, 1); - require("fstools/mkdir", 0, 1); - require("fstools/rm", 0, 1); - require("fstools/cp", 0, 1); - require("fstools/ln", 0, 1); - -/* until we rewrite the generators in C */ - require("fstools/awk", 0, 1); - - require("cc/argstd/*", 0, 0); - - require("cc/func_attr/unused/*", 0, 0); - require("cc/inline", 0, 0); - - return 0; -} - - Index: trunk/scconfig/librnd/scconfig/hooks_common.h =================================================================== --- trunk/scconfig/librnd/scconfig/hooks_common.h (revision 32153) +++ trunk/scconfig/librnd/scconfig/hooks_common.h (nonexistent) @@ -1,393 +0,0 @@ -/* the caller needs to provide these: */ -static void help1(void); -const arg_auto_set_t disable_libs[]; -int hook_custom_arg(const char *key, const char *value); - -/*** implementation ***/ -int want_coord_bits; - -const arg_auto_set_t rnd_disable_libs[] = { /* list of --disable-LIBs and the subtree they affect */ - {"disable-xrender", "libs/gui/xrender", arg_lib_nodes, "$do not use xrender for lesstif"}, - {"disable-xinerama", "libs/gui/xinerama", arg_lib_nodes, "$do not use xinerama for lesstif"}, -/* -#undef plugin_def -#undef plugin_header -#undef plugin_dep -#define plugin_def(name, desc, default_, all_, hidlib_) plugin3_args(name, desc) -#define plugin_header(sect) -#define plugin_dep(plg, on, hidlib) -#include "plugins.h" -*/ - {NULL, NULL, NULL, NULL} -}; - -static void all_plugin_select(const char *state, int force); - -static void rnd_help1(const char *progname) -{ - printf("./configure: configure %s.\n", progname); - printf("\n"); - printf("Usage: ./configure [options]\n"); - printf("\n"); - printf("options are:\n"); - printf(" --prefix=path change installation prefix from /usr/local to path\n"); - printf(" --debug build full debug version (-g -O0, extra asserts)\n"); - printf(" --profile build profiling version if available (-pg)\n"); - printf(" --symbols include symbols (add -g, but no -O0 or extra asserts)\n"); - printf(" --man1dir=path change installation path of man1 files (under prefix)\n"); - printf(" --libarchdir=relpath relative path under prefix for arch-lib-dir (e.g. lib64)\n"); - printf(" --confdir=path change installed conf path (normally matches sharedir)\n"); - printf(" --coord=32|64 set coordinate integer type's width in bits\n"); - printf(" --workaround-gtk-ctrl enable GTK control key query workaround\n"); - printf(" --all=plugin enable all working plugins for dynamic load\n"); - printf(" --all=buildin enable all working plugins for static link\n"); - printf(" --all=disable disable all plugins (compile core only)\n"); - printf(" --force-all=plugin enable even broken plugins for dynamic load\n"); - printf(" --force-all=buildin enable even broken plugins for static link\n"); -} - -static void help2(void) -{ - printf("\n"); - printf("Some of the --disable options will make ./configure to skip detection of the given feature and mark them \"not found\"."); - printf("\n"); -} - -char *repeat = NULL; -#define report_repeat(msg) \ -do { \ - report(msg); \ - if (repeat != NULL) { \ - char *old = repeat; \ - repeat = str_concat("", old, msg, NULL); \ - free(old); \ - } \ - else \ - repeat = strclone(msg); \ -} while(0) - -static int rnd_hook_custom_arg_(const char *key, const char *value, const arg_auto_set_t *disable_libs) -{ - if (strcmp(key, "prefix") == 0) { - report("Setting prefix to '%s'\n", value); - put("/local/prefix", strclone(value)); - return 1; - } - if (strcmp(key, "debug") == 0) { - put("/local/pcb/debug", strue); - pup_set_debug(strue); - return 1; - } - if (strcmp(key, "profile") == 0) { - put("/local/pcb/profile", strue); - return 1; - } - if (strcmp(key, "symbols") == 0) { - put("/local/pcb/symbols", strue); - return 1; - } - if ((strcmp(key, "all") == 0) || (strcmp(key, "force-all") == 0)) { - if ((strcmp(value, sbuildin) == 0) || (strcmp(value, splugin) == 0) || (strcmp(value, sdisable) == 0)) { - all_plugin_select(value, (key[0] == 'f')); - return 1; - } - report("Error: unknown --all argument: %s\n", value); - exit(1); - } - if (strcmp(key, "man1dir") == 0) { - put("/local/man1dir", value); - return 1; - } - if (strcmp(key, "libarchdir") == 0) { - put("/local/libarchdir", value); - return 1; - } - if (strcmp(key, "confdir") == 0) { - put("/local/confdir", value); - return 1; - } - if (strcmp(key, "help") == 0) { - help1(); - printf("\nplugin control:\n"); - arg_auto_print_options(stdout, " ", " ", rnd_disable_libs); - if (disable_libs != NULL) - arg_auto_print_options(stdout, " ", " ", disable_libs); - help2(); - printf("\n"); - help_default_args(stdout, ""); - exit(0); - } - if (strncmp(key, "workaround-", 11) == 0) { - const char *what = key+11; - if (strcmp(what, "gtk-ctrl") == 0) append("/local/pcb/workaround_defs", "\n#define PCB_WORKAROUND_GTK_CTRL 1"); - else if (strcmp(what, "gtk-shift") == 0) append("/local/pcb/workaround_defs", "\n#define PCB_WORKAROUND_GTK_SHIFT 1"); - else { - report("ERROR: unknown workaround '%s'\n", what); - exit(1); - } - return 1; - } - if ((strcmp(key, "with-intl") == 0) || (strcmp(key, "enable-intl") == 0)) { - report("ERROR: --with-intl is no longer supported, please do not use it\n"); - return 1; - } - if (strcmp(key, "coord") == 0) { - int v = atoi(value); - if ((v != 32) && (v != 64)) { - report("ERROR: --coord needs to be 32 or 64.\n"); - exit(1); - } - put("/local/pcb/coord_bits", value); - want_coord_bits = v; - return 1; - } - if (arg_auto_set(key, value, rnd_disable_libs) > 0) - return 1; - - return 0; -} - -#define rnd_hook_custom_arg(key, value, disable_libs) \ -do { \ - if (rnd_hook_custom_arg_(key, value, disable_libs)) \ - return 1; \ -} while(0) - -/* execute plugin dependency statements, depending on "require": - require = 0 - attempt to mark any dep as buildin - require = 1 - check if dependencies are met, disable plugins that have - unmet deps -*/ -int plugin_dep1(int require, const char *plugin, const char *deps_on, int hidlib) -{ - char buff[1024]; - const char *st_plugin, *st_deps_on; - int dep_chg = 0; - - sprintf(buff, "/local/pcb/%s/hidlib", plugin); - if (!hidlib) { /* may be inherited */ - hidlib = get(buff) != NULL; - } - - if (hidlib) { - put(buff, strue); - sprintf(buff, "/local/pcb/%s/hidlib", deps_on); - put(buff, strue); - } - - sprintf(buff, "/local/pcb/%s/controls", plugin); - st_plugin = get(buff); - sprintf(buff, "/local/pcb/%s/controls", deps_on); - st_deps_on = get(buff); - - if (require) { - if ((strcmp(st_plugin, sbuildin) == 0)) { - if (strcmp(st_deps_on, sbuildin) != 0) { - sprintf(buff, "WARNING: disabling (ex-buildin) %s because the %s is not enabled as a buildin...\n", plugin, deps_on); - report_repeat(buff); - sprintf(buff, "disable-%s", plugin); - hook_custom_arg(buff, NULL); - dep_chg++; - } - } - else if ((strcmp(st_plugin, splugin) == 0)) { - if ((strcmp(st_deps_on, sbuildin) != 0) && (strcmp(st_deps_on, splugin) != 0)) { - sprintf(buff, "WARNING: disabling (ex-plugin) %s because the %s is not enabled as a buildin or plugin...\n", plugin, deps_on); - report_repeat(buff); - sprintf(buff, "disable-%s", plugin); - hook_custom_arg(buff, NULL); - dep_chg++; - } - } - } - else { - if (strcmp(st_plugin, sbuildin) == 0) - put(buff, sbuildin); - else if (strcmp(st_plugin, splugin) == 0) { - if ((st_deps_on == NULL) || (strcmp(st_deps_on, "disable") == 0)) - put(buff, splugin); - } - dep_chg++; - } - return dep_chg; -} - -static void all_plugin_select(const char *state, int force) -{ - char buff[1024]; - -#undef plugin_def -#undef plugin_header -#undef plugin_dep -#define plugin_def(name, desc, default_, all_, hidlib_) \ - if ((all_) || force) { \ - sprintf(buff, "/local/pcb/%s/controls", name); \ - put(buff, state); \ - } -#define plugin_header(sect) -#define plugin_dep(plg, on, hidlib) -#include "plugins.h" -} - -/* set up /hidlib nodes in the db to indicate which plugins are in the hidlib */ -static void plugin_db_hidlib(void) -{ - char buff[1024]; - -#undef plugin_def -#undef plugin_header -#undef plugin_dep -#define plugin_def(name, desc, default_, all_, hidlib_) \ - if (hidlib_) { \ - sprintf(buff, "/local/pcb/%s/hidlib", name); \ - put(buff, strue); \ - } -#define plugin_header(sect) -#define plugin_dep(plg, on, hidlib) -#include "plugins.h" -} - -int plugin_deps(int require) -{ - int dep_chg = 0; -#undef plugin_def -#undef plugin_header -#undef plugin_dep -#define plugin_def(name, desc, default_, all_, hidlib_) -#define plugin_header(sect) -#define plugin_dep(plg, on, hidlib) dep_chg += plugin_dep1(require, plg, on, hidlib); -#include "plugins.h" - return dep_chg; -} - - -void rnd_hook_postinit() -{ - pup_hook_postinit(); - fungw_hook_postinit(); - - /* DEFAULTS */ - put("/local/prefix", "/usr/local"); - put("/local/man1dir", "/share/man/man1"); - put("/local/libarchdir", "lib"); - put("/local/confdir", ""); - put("/local/pcb/debug", sfalse); - put("/local/pcb/profile", sfalse); - put("/local/pcb/symbols", sfalse); - -#undef plugin_def -#undef plugin_header -#undef plugin_dep -#define plugin_def(name, desc, default_, all_, hidlib_) plugin3_default(name, default_) -#define plugin_header(sect) -#define plugin_dep(plg, on, hidlib) -#include "plugins.h" - - put("/local/pcb/coord_bits", "32"); - want_coord_bits = 32; -} - - -static int all_plugin_check_explicit(void) -{ - char pwanted[1024], pgot[1024]; - const char *wanted, *got; - int tainted = 0; - -#undef plugin_def -#undef plugin_header -#undef plugin_dep -#define plugin_def(name, desc, default_, all_, hidlib_) \ - sprintf(pwanted, "/local/pcb/%s/explicit", name); \ - wanted = get(pwanted); \ - if (wanted != NULL) { \ - sprintf(pgot, "/local/pcb/%s/controls", name); \ - got = get(pgot); \ - if (strcmp(got, wanted) != 0) {\ - report("ERROR: %s was requested to be %s but I had to %s it\n", name, wanted, got); \ - tainted = 1; \ - } \ - } -#define plugin_header(sect) -#define plugin_dep(plg, on, hidlib) -#include "plugins.h" - return tainted; -} - - -/* Runs after all arguments are read and parsed */ -int rnd_hook_postarg() -{ - int limit = 128; - - /* repeat as long as there are changes - this makes it "recursive" on - resolving deps */ - while(plugin_deps(0) && (limit > 0)) limit--; - - return 0; -} - -int safe_atoi(const char *s) -{ - if (s == NULL) - return 0; - return atoi(s); -} - -static void plugin_stat(const char *header, const char *path, const char *name) -{ - const char *val = get(path); - - if (*header == '#') /* don't print hidden plugins */ - return; - - printf(" %-32s", header); - - if (val == NULL) - printf("??? (NULL) "); - else if (strcmp(val, sbuildin) == 0) - printf("yes, buildin "); - else if (strcmp(val, splugin) == 0) - printf("yes, PLUGIN "); - else - printf("no "); - - printf(" [%s]\n", name); -} - -static void print_sum_setting_or(const char *node, const char *desc, int or) -{ - const char *res, *state; - state = get(node); - if (or) - res = "enabled (implicit)"; - else if (istrue(state)) - res = "enabled"; - else if (isfalse(state)) - res = "disabled"; - else - res = "UNKNOWN - disabled?"; - printf("%-55s %s\n", desc, res); -} - -static void print_sum_setting(const char *node, const char *desc) -{ - print_sum_setting_or(node, desc, 0); -} - -static void print_sum_cfg_val(const char *node, const char *desc) -{ - const char *state = get(node); - printf("%-55s %s\n", desc, state); -} - -static int rnd_hook_generate() -{ - int generr = 0; - - printf("Generating librnd.mak (%d)\n", generr |= tmpasm("../src/librnd/core", "librnd.mak.in", "librnd.mak")); - printf("Generating compat_inc.h (%d)\n", generr |= tmpasm("../src/librnd/core", "compat_inc.h.in", "compat_inc.h")); - printf("Generating librnd config.h (%d)\n", generr |= tmpasm("../src/librnd", "config.h.in", "config.h")); - - return generr; -} Index: trunk/scconfig/librnd/scconfig/plugin_3state.h =================================================================== --- trunk/scconfig/librnd/scconfig/plugin_3state.h (revision 32153) +++ trunk/scconfig/librnd/scconfig/plugin_3state.h (nonexistent) @@ -1,63 +0,0 @@ -/* 3-state plugin system; possible states of each plugin, stored in - /local/pcb/PLUGIN_NAME/controls: - "disable" = do not compile it at all - "buildin" = enable, static link into the executable - "plugin" = enable, make it a dynamic link library (runtime load plugin) -*/ - -#define sdisable "disable" -#define sbuildin "buildin" -#define splugin "plugin" - - -/* Macros to check the state */ - -#define plug_eq(name, val) \ - ((get("/local/pcb/" name "/controls") != NULL) && (strcmp(get("/local/pcb/" name "/controls"), val) == 0)) - -#define plug_is_enabled(name) (plug_eq(name, splugin) || plug_eq(name, sbuildin)) -#define plug_is_disabled(name) (plug_eq(name, sdisabled)) -#define plug_is_buildin(name) (plug_eq(name, sbuildin)) -#define plug_is_plugin(name) (plug_eq(name, splugin)) - -/* auto-set tables to change control to the desired value */ -const arg_auto_set_node_t arg_disable[] = { - {"controls", sdisable}, - {"explicit", sdisable}, - {NULL, NULL} -}; - -const arg_auto_set_node_t arg_Disable[] = { - {"controls", sdisable}, - {NULL, NULL} -}; - -const arg_auto_set_node_t arg_buildin[] = { - {"controls", sbuildin}, - {"explicit", sbuildin}, - {NULL, NULL} -}; - -const arg_auto_set_node_t arg_plugin[] = { - {"controls", splugin}, - {"explicit", splugin}, - {NULL, NULL} -}; - - -/* plugin_def implementation to create CLI args */ -#define plugin3_args(name, desc) \ - {"disable-" name, "/local/pcb/" name, arg_disable, "$do not compile " desc}, \ - {"Disable-" name, "/local/pcb/" name, arg_Disable, NULL }, \ - {"buildin-" name, "/local/pcb/" name, arg_buildin, "$static link " desc " into the executable"}, \ - {"plugin-" name, "/local/pcb/" name, arg_plugin, "$" desc " is a dynamic loadable plugin"}, - - -/* plugin_def implementation to set default state */ -#define plugin3_default(name, default_) \ - db_mkdir("/local/pcb/" name); \ - put("/local/pcb/" name "/controls", default_); - -/* plugin_def implementation to print a report with the final state */ -#define plugin3_stat(name, desc) \ - plugin_stat(desc, "/local/pcb/" name "/controls", name); Index: trunk/scconfig/librnd/scconfig/hooks_gui.c =================================================================== --- trunk/scconfig/librnd/scconfig/hooks_gui.c (revision 32153) +++ trunk/scconfig/librnd/scconfig/hooks_gui.c (nonexistent) @@ -1,29 +0,0 @@ -/* if any of these are enabled, we need the dialog plugin; dialog can not be - a pup dep because it must be omitted from the hidlib */ -static const char *dialog_deps[] = { - "/local/pcb/dialogs/controls", /* so we don't relax user's explicit request */ - "/local/pcb/hid_remote/controls", - "/local/pcb/lib_gtk_common/controls", - "/local/pcb/hid_lesstif/controls", - NULL -}; - - -void rnd_calc_dialog_deps(void) -{ - const char **p; - int buildin = 0, plugin = 0; - - for(p = dialog_deps; *p != NULL; p++) { - const char *st = get(*p); - if (strcmp(st, "buildin") == 0) { - buildin = 1; - break; - } - if (strcmp(st, "plugin") == 0) - plugin = 1; - } - - put("/target/librnd/dialogs/buildin", buildin ? strue : sfalse); - put("/target/librnd/dialogs/plugin", plugin ? strue : sfalse); -} Index: trunk/scconfig =================================================================== --- trunk/scconfig (revision 32153) +++ trunk/scconfig (revision 32154) Property changes on: trunk/scconfig ___________________________________________________________________ Modified: svn:externals ## -1 +1,2 ## svn://svn.repo.hu/scconfig/trunk/src src +svn://svn.repo.hu/librnd/trunk/scconfig/librnd librnd