Changeset: d8661930f36c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d8661930f36c
Modified Files:
clients/mapilib/mapi.mx
common/options/monet_options.mx
configure.ag
gdk/gdk_utils.mx
tools/merovingian/client/monetdb.c
tools/merovingian/daemon/merovingian.c
tools/mserver/monet_version.c.in
tools/mserver/mserver5.c
Branch: default
Log Message:
buildsys: use expanded variables from configure
Expand values that we use in C, so we don't need to do replacement of
${prefix}. This simplifies matters, since we only have to deal with
real paths from now on. It also means we no longer need PREFIX.
diffs (233 lines):
diff --git a/clients/mapilib/mapi.mx b/clients/mapilib/mapi.mx
--- a/clients/mapilib/mapi.mx
+++ b/clients/mapilib/mapi.mx
@@ -2176,7 +2176,7 @@
char buf[1024];
struct stat st;
snprintf(buf, sizeof(buf),
- PREFIX "/var/monetdb5/dbfarm/mapi_socket");
+ LOCALSTATEDIR "/monetdb5/dbfarm/mapi_socket");
if (strlen(buf) <= sizeof(((struct sockaddr_un *)
0)->sun_path) &&
stat(buf, &st) != -1 &&
S_ISSOCK(st.st_mode))
diff --git a/common/options/monet_options.mx b/common/options/monet_options.mx
--- a/common/options/monet_options.mx
+++ b/common/options/monet_options.mx
@@ -67,16 +67,6 @@
(set,setlen). */
moptions_export char *mo_find_option(opt *set, int setlen, const char *name);
-/* the option values can contain ${variable} (or %variable%), these
- will be substituted using the mo_substitute function. The return
- value is a newly allocated buffer, it is the caller's
- responsibility to free the buffer. */
-#ifdef WIN32
-/* on Windows, the option values can also contain %prefix% and
- %exec_prefix% which will be substituted as well. */
-#endif
-moptions_export char *mo_substitute(opt *set, int setlen, char *name);
-
/* mo_system_config will add the options from the system config file
(returns the new setlen) */
moptions_export int mo_system_config(opt **Set, int setlen);
@@ -183,68 +173,6 @@
return NULL;
}
-char *
-mo_substitute(opt *set, int setlen, char *val)
-{
- char *q;
- size_t n = strlen(val) + 1;
- char *s = strdup(val);
-
- setlen = mo_default_set(&set, setlen);
- q = s;
- while ((q = strchr(q, '$')) != NULL) {
- char *r = NULL;
-
- if (q[1] == '{' && (r = strchr(q, '}')) != NULL) {
- size_t len = r - q;
- char *p, *t;
-
- *r = 0;
- if (strcmp(q + 2, "prefix") == 0)
- p = PREFIX;
- else
- p = mo_find_option(set, setlen, q + 2);
- if (!p) {
- *r = '}';
- return s;
- }
- t = malloc((n = n - len + strlen(p)));
- *q = 0;
- snprintf(t, n, "%s%s%s", s, p, r + 1);
- q = t + (q - s);
- free(s);
- s = t;
- } else
- q++;
- }
-#ifdef WIN32
- q = s;
- while ((q = strchr(q, '%')) != NULL) {
- char *r = NULL;
-
- if ((r = strchr(q + 1, '%')) != NULL) {
- size_t len = r - q;
- char *p, *t;
-
- *r = 0;
- p = mo_find_option(set, setlen, q + 1);
- if (!p) {
- *r = '%';
- return s;
- }
- t = malloc((n = n - len + strlen(p)));
- *q = 0;
- snprintf(t, n, "%s%s%s", s, p, r + 1);
- q = t + (q - s);
- free(s);
- s = t;
- } else
- q++;
- }
-#endif
- return s;
-}
-
static int
mo_config_file(opt **Set, int setlen, char *file)
{
@@ -347,7 +275,6 @@
cfg = mo_find_option(*Set, setlen, "config");
if (!cfg)
return setlen;
- cfg = mo_substitute(*Set, setlen, cfg);
setlen = mo_config_file(Set, setlen, cfg);
free(cfg);
return setlen;
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2960,6 +2960,8 @@
Qlocalstatedir="$localstatedir"
Xlocalstatedir="`$translatepath "$localstatedir"`"
QXlocalstatedir="`echo "$Xlocalstatedir" | sed 's/\\\\/\\\\\\\\/g'`"
+eval "Elocalstatedir=${Xlocalstatedir}"
+QElocalstatedir="`echo "$Elocalstatedir" | sed 's/\\\\/\\\\\\\\/g'`"
AC_SUBST(Qlocalstatedir)
AC_SUBST(Xlocalstatedir)
AC_SUBST(QXlocalstatedir)
@@ -2978,6 +2980,8 @@
Qbindir="$bindir"
Xbindir="`$translatepath "$bindir"`"
QXbindir="`echo "$Xbindir" | sed 's/\\\\/\\\\\\\\/g'`"
+eval "Ebindir=${Xbindir}"
+QEbindir="`echo "$Ebindir" | sed 's/\\\\/\\\\\\\\/g'`"
AC_SUBST(Qbindir)
AC_SUBST(Xbindir)
AC_SUBST(QXbindir)
@@ -3021,8 +3025,6 @@
AC_SUBST(Xinfodir)
AC_SUBST(QXinfodir)
-AC_DEFINE_UNQUOTED(PREFIX,"$QXprefix",[architecture-independent files])
-AC_DEFINE_UNQUOTED(EXEC_PREFIX,"$QXexec_prefix",[architecture-dependent files])
QBUILD="$BUILD"
XBUILD="`$translatepath "$BUILD"`"
QXBUILD="`echo "$XBUILD" | sed 's/\\\\/\\\\\\\\/g'`"
@@ -3035,11 +3037,10 @@
AC_SUBST(QSOURCE)
AC_SUBST(XSOURCE)
AC_SUBST(QXSOURCE)
-AC_DEFINE_UNQUOTED(LOCALSTATEDIR,"$QXlocalstatedir",[modifiable single-machine
data])
-AC_DEFINE_UNQUOTED(LIBDIR,"$QXlibdir",[object code libraries])
-AC_DEFINE_UNQUOTED(SYSCONFDIR,"$QXsysconfdir",[read-only single-machine data])
-AC_SUBST([MERO_LOG], [${localstatedir}/log/monetdb/merovingian.log])
-AC_DEFINE_UNQUOTED([MERO_LOG],
["${localstatedir}/log/monetdb/merovingian.log"], [where Merovingian will store
its logs by default])
+AC_DEFINE_UNQUOTED(LOCALSTATEDIR,"$QElocalstatedir",[modifiable single-machine
data])
+AC_DEFINE_UNQUOTED(BINDIR,"$QEbindir",[location where binaries are installed])
+AC_SUBST([MERO_LOG], [${Elocalstatedir}/log/monetdb/merovingian.log])
+AC_DEFINE_UNQUOTED([MERO_LOG],
["${Elocalstatedir}/log/monetdb/merovingian.log"], [where Merovingian will
store its logs by default])
dnl On Solaris, libxml2 enables threading only when _REENTRANT, __MT__
dnl or _POSIX_C_SOURCE >= 199506L is defined. The latter is only
diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -1651,12 +1651,8 @@
#endif
gdk_alloc_map = strcasecmp(alloc_map, "yes") == 0;
errno = 0;
- dbfarm = mo_substitute(set, setlen, dbfarm);
- if (!GDKenvironment(dbname, dbfarm)) {
- free(dbfarm);
+ if (!GDKenvironment(dbname, dbfarm))
return 0;
- }
- free(dbfarm);
if ((p = mo_find_option(set, setlen, "gdk_debug")))
GDKdebug = strtol(p, NULL, 10);
@@ -1711,13 +1707,8 @@
nlen++;
}
}
- for (i = 0; i < nlen; i++) {
- char *value;
-
- value = mo_substitute(n, nlen, n[i].value);
- GDKsetenv(n[i].name, value);
- free(value);
- }
+ for (i = 0; i < nlen; i++)
+ GDKsetenv(n[i].name, n[i].value);
free(n);
if ((p = GDKgetenv("gdk_mem_maxsize"))) {
diff --git a/tools/merovingian/client/monetdb.c
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -1359,7 +1359,6 @@
int i;
int fd;
confkeyval ckv[] = {
- {"prefix", strdup(PREFIX), STR},
{"gdk_dbfarm", strdup(LOCALSTATEDIR
"/monetdb5/dbfarm"), STR},
{"gdk_nr_threads", NULL, INT},
{"mero_doproxy", strdup("yes"), BOOL},
diff --git a/tools/merovingian/daemon/merovingian.c
b/tools/merovingian/daemon/merovingian.c
--- a/tools/merovingian/daemon/merovingian.c
+++ b/tools/merovingian/daemon/merovingian.c
@@ -406,7 +406,6 @@
pthread_mutexattr_t mta;
int thret;
confkeyval ckv[] = {
- {"prefix", strdup(PREFIX), STR},
{"gdk_dbfarm", strdup(LOCALSTATEDIR
"/monetdb5/dbfarm"), STR},
{"gdk_nr_threads", NULL, INT},
{"sql_optimizer", NULL, STR},
diff --git a/tools/mserver/monet_version.c.in b/tools/mserver/monet_version.c.in
--- a/tools/mserver/monet_version.c.in
+++ b/tools/mserver/monet_version.c.in
@@ -61,7 +61,6 @@
"using %d thread%s\n",
GDKnr_threads, GDKnr_threads != 1 ? "s" : ""); */
#endif
- printf("Configured for prefix: " PREFIX "\n");
printf("Libraries:\n");
{
char pcreversion[] = "@pcreversion@";
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -307,8 +307,6 @@
if (!(setlen = mo_builtin_settings(&set)))
usage(prog);
- setlen = mo_add_option(&set, setlen, opt_config, "prefix", PREFIX);
-
for (;;) {
int option_index = 0;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list