Index: config.h.in =================================================================== --- config.h.in (revision 8053) +++ config.h.in (revision 8054) @@ -43,6 +43,8 @@ print {\n\n/* Macro to add a funciton attribute to suppress "function unused" for static inline functions declared in .h files */\n} print_ternary ?cc/func_attr/unused/presents {#define PCB_FUNC_UNUSED __attribute__((unused))} {#define PCB_FUNC_UNUSED} +print {\n\n/* Wether setenv() works */\n} +print_ternary ?libs/env/setenv/presents {#define PCB_HAVE_SETENV 1} {/* #undef PCB_HAVE_SETENV */} print {\n\n/* Define to 1 if you have the `snprintf' function. */\n} print_ternary ?libs/snprintf {#define HAVE_SNPRINTF 1} {/* #undef HAVE_SNPRINTF */} Index: scconfig/Rev.h =================================================================== --- scconfig/Rev.h (revision 8053) +++ scconfig/Rev.h (revision 8054) @@ -1 +1 @@ -static const int myrev = 7998; +static const int myrev = 8054; Index: scconfig/Rev.tab =================================================================== --- scconfig/Rev.tab (revision 8053) +++ scconfig/Rev.tab (revision 8054) @@ -1,3 +1,4 @@ +8054 configure setenv() detection for parametric footprint env 7998 configure gtk GTK3 box compatibility 7968 configure clean up global namespace: rename VERSION, PACKAGE and REVISION 7967 configure rename import_hyp to io_hyp Index: scconfig/hooks.c =================================================================== --- scconfig/hooks.c (revision 8053) +++ scconfig/hooks.c (revision 8054) @@ -312,6 +312,7 @@ require("cc/fpic", 0, 1); require("signal/names/*", 0, 0); + require("libs/env/setenv/*", 0, 0); require("libs/fs/mkdtemp/*", 0, 0); require("libs/fs/realpath/*", 0, 0); require("libs/fs/readdir/*", 0, 1); Index: src/compat_inc.h.in =================================================================== --- src/compat_inc.h.in (revision 8053) +++ src/compat_inc.h.in (revision 8054) @@ -14,6 +14,7 @@ @?/target/libs/fs/readdir/includes@ @?/target/libs/userpass/getpwuid/includes@ @?/target/libs/math/round/includes@ +@?/target/libs/env/setenv/includes@ @] put /tmpasm/IFS {\n} Index: src/compat_misc.c =================================================================== --- src/compat_misc.c (revision 8053) +++ src/compat_misc.c (revision 8054) @@ -22,6 +22,8 @@ #include "config.h" + + #include #include #include @@ -162,3 +164,17 @@ } return tolower(*s1) - tolower(*s2); } + +#ifdef PCB_HAVE_SETENV + extern int setenv(); +#endif + +int pcb_setenv(const char *name, const char *val, int overwrite) +{ +#ifdef PCB_HAVE_SETENV + return setenv(name, val, overwrite); +#else + return -1; +#endif +} + Index: src/compat_misc.h =================================================================== --- src/compat_misc.h (revision 8053) +++ src/compat_misc.h (revision 8054) @@ -43,4 +43,6 @@ int pcb_strcasecmp(const char *s1, const char *s2); int pcb_strncasecmp(const char *s1, const char *s2, size_t n); +int pcb_setenv(const char *name, const char *val, int overwrite); + #endif /* PCB_COMPAT_MISC_H */ Index: src/main.c =================================================================== --- src/main.c (revision 8053) +++ src/main.c (revision 8054) @@ -207,12 +207,12 @@ conf_set(CFR_INTERNAL, "rc/path/exec_prefix", -1, exec_prefix, POL_OVERWRITE); /* export the most important paths and data for child processes (e.g. parametric footprints) */ - setenv("PCB_RND_VERSION", PCB_VERSION, 1); - setenv("PCB_RND_REVISION", PCB_REVISION, 1); - setenv("PCB_RND_PCBLIB", PCBSHAREDIR "/pcblib", 1); - setenv("PCB_RND_SHARE", PCBSHAREDIR, 1); - setenv("PCB_RND_LIB", PCBLIBDIR, 1); - setenv("PCB_RND_EXEC_PREFIX", exec_prefix, 1); + pcb_setenv("PCB_RND_VERSION", PCB_VERSION, 1); + pcb_setenv("PCB_RND_REVISION", PCB_REVISION, 1); + pcb_setenv("PCB_RND_PCBLIB", PCBSHAREDIR "/pcblib", 1); + pcb_setenv("PCB_RND_SHARE", PCBSHAREDIR, 1); + pcb_setenv("PCB_RND_LIB", PCBLIBDIR, 1); + pcb_setenv("PCB_RND_EXEC_PREFIX", exec_prefix, 1); free(exec_prefix); free(bindir);