[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r775 - in GNUnet: . contrib contrib/win m4 src/conf src/inc
From: |
durner |
Subject: |
[GNUnet-SVN] r775 - in GNUnet: . contrib contrib/win m4 src/conf src/include src/util |
Date: |
Wed, 11 May 2005 14:06:05 -0700 (PDT) |
Author: durner
Date: 2005-05-11 14:03:50 -0700 (Wed, 11 May 2005)
New Revision: 775
Added:
GNUnet/m4/ac_define_dir.m4
Modified:
GNUnet/configure.ac
GNUnet/contrib/config-client.in
GNUnet/contrib/config-daemon.in
GNUnet/contrib/config.in
GNUnet/contrib/win/Installer.nsi
GNUnet/src/conf/Makefile.am
GNUnet/src/conf/conf.c
GNUnet/src/conf/gconf.c
GNUnet/src/conf/mconf.c
GNUnet/src/conf/menu.c
GNUnet/src/conf/qconf.cc
GNUnet/src/conf/wizard.c
GNUnet/src/include/gnunet_util.h
GNUnet/src/util/Makefile.am
GNUnet/src/util/configuration.c
Log:
- define DATADIR and LOCALEDIR in configure.ac because of MinGW
- read configuration templates (contrib/*.in) from DATADIR
- fix configuration templates
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/configure.ac 2005-05-11 21:03:50 UTC (rev 775)
@@ -130,6 +130,13 @@
AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
AC_MSG_RESULT([$build_target])
+# We define the paths here, because MinGW/GCC expands paths
+# passed through the command line ("-DDATADIR=..."). This would
+# lead to hard-coded paths ("C:\mingw\mingw\bin...") that do
+# not contain the actual GNUnet installation. GNUnet usually lives in
+# "C:\Program Files\GNU\GNUnet\bin".
+AC_DEFINE_DIR([DATADIR], [datadir/gnunet], [The directory for installing
read-only architecture-independent data])
+AC_DEFINE_DIR([LOCALEDIR], [datadir/locale], [gettext catalogs])
CHECK_PTHREAD
Modified: GNUnet/contrib/config-client.in
===================================================================
--- GNUnet/contrib/config-client.in 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/contrib/config-client.in 2005-05-11 21:03:50 UTC (rev 775)
@@ -5,7 +5,7 @@
config config-user.in_CONF_DEF_DIR
string "Default configuration directory"
depends on RARE-CLIENT
- default "/etc/"
+ default "~/.gnunet/"
help
This is the directory where gnunet-setup will store the configuration
file by default.
@@ -14,11 +14,11 @@
config config-user.in_CONF_DEF_FILE
string "Default configuration file"
depends on RARE-CLIENT
- default "gnunet-user.conf"
+ default "gnunet.conf"
help
This is the filename under which gnunet-setup will store the
configuration
by default.
- Default: config-user.in_CONF_DEF_FILE = gnunet-user.conf
+ Default: config-user.in_CONF_DEF_FILE = gnunet.conf
config ADVANCED-CLIENT
bool "Show options for advanced users"
Modified: GNUnet/contrib/config-daemon.in
===================================================================
--- GNUnet/contrib/config-daemon.in 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/contrib/config-daemon.in 2005-05-11 21:03:50 UTC (rev 775)
@@ -18,7 +18,7 @@
help
This is the filename under which gnunet-setup will store the
configuration
by default.
- Default: config.in_CONF_DEF_FILE = gnunet.conf
+ Default: config.in_CONF_DEF_FILE = gnunetd.conf
config EXPERIMENTAL
bool "Prompt for development and/or incomplete code"
Modified: GNUnet/contrib/config.in
===================================================================
--- GNUnet/contrib/config.in 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/contrib/config.in 2005-05-11 21:03:50 UTC (rev 775)
@@ -1,4 +1,4 @@
mainmenu "GNUnet user configuration"
-source "/etc/config.in"
-source "/etc/config-user.in"
+source "$DATADIR/config.in"
+source "$DATADIR/config-user.in"
Modified: GNUnet/contrib/win/Installer.nsi
===================================================================
--- GNUnet/contrib/win/Installer.nsi 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/contrib/win/Installer.nsi 2005-05-11 21:03:50 UTC (rev 775)
@@ -205,6 +205,11 @@
File "C:\GNUnet\etc\gnunet.root"
Rename "$INSTDIR\etc\gnunet.root" "$INSTDIR\etc\gnunet.conf"
Rename "$USR_PROF\gnunet.user" "$USR_PROF\gnunet.conf"
+
+ SetOutPath "$INSTDIR\share\GNUnet"
+ File "C:\GNUnet\share\GNUnet\config.in"
+ File "C:\GNUnet\share\GNUnet\config-client.in"
+ File "C:\GNUnet\share\GNUnet\config-daemon.in"
SectionEnd
Section "Extractor" SEC03
Added: GNUnet/m4/ac_define_dir.m4
===================================================================
--- GNUnet/m4/ac_define_dir.m4 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/m4/ac_define_dir.m4 2005-05-11 21:03:50 UTC (rev 775)
@@ -0,0 +1,35 @@
+dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+dnl
+dnl This macro _AC_DEFINEs VARNAME to the expansion of the DIR
+dnl variable, taking care of fixing up ${prefix} and such.
+dnl
+dnl VARNAME is offered as both a C preprocessor symbol, and an output
+dnl variable.
+dnl
+dnl Note that the 3 argument form is only supported with autoconf 2.13
+dnl and later (i.e. only where _AC_DEFINE supports 3 arguments).
+dnl
+dnl Examples:
+dnl
+dnl AC_DEFINE_DIR(DATADIR, datadir)
+dnl AC_DEFINE_DIR(PROG_PATH, bindir, [Location of installed binaries])
+dnl
+dnl @category Misc
+dnl @author Stepan Kasal <address@hidden>
+dnl @author Andreas Schwab <address@hidden>
+dnl @author Guido Draheim <address@hidden>
+dnl @author Alexandre Oliva
+dnl @version 2005-01-17
+dnl @license AllPermissive
+
+AC_DEFUN([AC_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+ eval ac_define_dir="\"[$]$2\""
+ AC_SUBST($1, "$ac_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
Modified: GNUnet/src/conf/Makefile.am
===================================================================
--- GNUnet/src/conf/Makefile.am 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/Makefile.am 2005-05-11 21:03:50 UTC (rev 775)
@@ -5,8 +5,6 @@
# GNU Gettext support
LIBS = @LIBINTL@ @LIBS@
-DEFS = -DDATADIR=\"$(pkgdatadir)\" @DEFS@
-
if MINGW
WINTOOL = gnunet-win-tool
endif
Modified: GNUnet/src/conf/conf.c
===================================================================
--- GNUnet/src/conf/conf.c 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/conf.c 2005-05-11 21:03:50 UTC (rev 775)
@@ -485,8 +485,9 @@
int conf_main(int ac, char **av)
{
int i = 1;
- const char *name;
struct stat tmpstat;
+ const char * LANG;
+ char * configFile;
if (ac > i && av[i][0] == '-') {
switch (av[i++][1]) {
@@ -528,11 +529,25 @@
exit(0);
}
}
- name = av[i];
- if (!name) {
- printf("%s: Kconfig file missing\n", av[0]);
- }
- conf_parse(name);
+
+ LANG = getenv("LANG");
+ if (LANG == NULL)
+ LANG = "en";
+ if (strncmp(LANG, "en", 2))
+ LANG = NULL;
+ configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
+ strcpy(configFile,
+ DATADIR"/config.in");
+ if (LANG != NULL) {
+ strcat(configFile, ".");
+ strncat(configFile,
+ LANG,
+ 2);
+ }
+
+ conf_parse(configFile);
+ FREE(configFile);
+
switch (input_mode) {
case set_default:
if (!defconfig_file)
Modified: GNUnet/src/conf/gconf.c
===================================================================
--- GNUnet/src/conf/gconf.c 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/gconf.c 2005-05-11 21:03:50 UTC (rev 775)
@@ -1692,8 +1692,8 @@
int gconf_main(int ac, char *av[])
{
- const char * LANG;
- char * configFile;
+ const char * LANG;
+ char * configFile;
#ifndef LKC_DIRECT_LINK
kconfig_load();
@@ -1726,22 +1726,22 @@
}
}
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en") == 2)
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
-
DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
-
LANG,
-
2);
- }
+ LANG = getenv("LANG");
+ if (LANG == NULL)
+ LANG = "en";
+ if (strncmp(LANG, "en", 2) == 0)
+ LANG = NULL;
+ configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
+ strcpy(configFile,
+
DATADIR"/config.in");
+ if (LANG != NULL) {
+ strcat(configFile, ".");
+ strncat(configFile,
+
LANG,
+
2);
+ }
conf_parse(configFile);
- FREE(configFile);
+ FREE(configFile);
fixup_rootmenu(&rootmenu);
conf_read(NULL);
Modified: GNUnet/src/conf/mconf.c
===================================================================
--- GNUnet/src/conf/mconf.c 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/mconf.c 2005-05-11 21:03:50 UTC (rev 775)
@@ -1,12 +1,26 @@
-/*
+/*
+ This file is part of GNUnet.
+ (C) 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
* Copyright (C) 2002 Roman Zippel <address@hidden>
* Released under the terms of the GNU GPL v2.0.
- *
- * Introduced single menu mode (show all sub-menus in one large tree).
- * 2002-11-06 Petr Baudis <address@hidden>
- *
- * Direct use of liblxdialog library routines.
- * 2003-02-04 Petr Baudis address@hidden
*/
/**
@@ -791,7 +805,27 @@
{
char *mode;
int stat;
- conf_parse(av[1]);
+ const char * LANG;
+ char * configFile;
+
+ LANG = getenv("LANG");
+ if (LANG == NULL)
+ LANG = "en";
+ if (strncmp(LANG, "en", 2) == 0)
+ LANG = NULL;
+ configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
+ strcpy(configFile,
+ DATADIR"/config.in");
+ if (LANG != NULL) {
+ strcat(configFile, ".");
+ strncat(configFile,
+ LANG,
+ 2);
+ }
+
+ conf_parse(configFile);
+ FREE(configFile);
+
conf_read(NULL);
backtitle = malloc(128);
Modified: GNUnet/src/conf/menu.c
===================================================================
--- GNUnet/src/conf/menu.c 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/menu.c 2005-05-11 21:03:50 UTC (rev 775)
@@ -380,15 +380,18 @@
struct file *file_lookup(const char *name)
{
struct file *file;
+ char *realfn;
+
+ realfn = expandDollar("", name);
for (file = file_list; file; file = file->next) {
- if (!strcmp(name, file->name))
+ if (!strcmp(realfn, file->name))
return file;
}
file = malloc(sizeof(*file));
memset(file, 0, sizeof(*file));
- file->name = strdup(name);
+ file->name = realfn;
file->next = file_list;
file_list = file;
return file;
Modified: GNUnet/src/conf/qconf.cc
===================================================================
--- GNUnet/src/conf/qconf.cc 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/qconf.cc 2005-05-11 21:03:50 UTC (rev 775)
@@ -1268,7 +1268,8 @@
int qconf_main(int ac, char** av)
{
ConfigMainWindow* v;
- const char *name;
+ const char * LANG;
+ char * configFile;
#ifndef LKC_DIRECT_LINK
kconfig_load();
@@ -1285,13 +1286,26 @@
case '?':
usage();
}
- name = av[2];
- } else
- name = av[1];
- if (!name)
- usage();
-
- conf_parse(name);
+ }
+
+ LANG = getenv("LANG");
+ if (LANG == NULL)
+ LANG = "en";
+ if (strncmp(LANG, "en", 2) == 0)
+ LANG = NULL;
+ configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
+ strcpy(configFile,
+ DATADIR"/config.in");
+ if (LANG != NULL) {
+ strcat(configFile, ".");
+ strncat(configFile,
+ LANG,
+ 2);
+ }
+
+ conf_parse(configFile);
+ FREE(configFile);
+
fixup_rootmenu(&rootmenu);
conf_read(NULL);
//zconfdump(stdout);
Modified: GNUnet/src/conf/wizard.c
===================================================================
--- GNUnet/src/conf/wizard.c 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/conf/wizard.c 2005-05-11 21:03:50 UTC (rev 775)
@@ -288,7 +288,9 @@
wizard_main (int argc, char *argv[])
{
#ifdef ENABLE_NLS
- char lcdir[251];
+ char lcdir[251];
+ const char * LANG;
+ char * configFile;
setlocale (LC_ALL, "");
getLocaleDir(lcdir);
@@ -305,7 +307,24 @@
gtk_set_locale ();
gtk_init (&argc, &argv);
- conf_parse(argv[1]);
+ LANG = getenv("LANG");
+ if (LANG == NULL)
+ LANG = "en";
+ if (strncmp(LANG, "en", 2) == 0)
+ LANG = NULL;
+ configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
+ strcpy(configFile,
+ DATADIR"/config.in");
+ if (LANG != NULL) {
+ strcat(configFile, ".");
+ strncat(configFile,
+ LANG,
+ 2);
+ }
+
+ conf_parse(configFile);
+ FREE(configFile);
+
conf_read(NULL);
curwnd = create_assi_step1 ();
Modified: GNUnet/src/include/gnunet_util.h
===================================================================
--- GNUnet/src/include/gnunet_util.h 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/include/gnunet_util.h 2005-05-11 21:03:50 UTC (rev 775)
@@ -616,6 +616,15 @@
void readConfiguration();
/**
+ * Expand an expression of the form
+ * "$FOO/BAR" to "DIRECTORY/BAR" where
+ * either in the current section or
+ * globally FOO is set to DIRECTORY.
+ */
+char * expandDollar(const char * section,
+ char * orig);
+
+/**
* Obtain a filename from the given section and option. If the
* filename is not specified, die with the given error message (do not
* die if errMsg == NULL).
Modified: GNUnet/src/util/Makefile.am
===================================================================
--- GNUnet/src/util/Makefile.am 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/util/Makefile.am 2005-05-11 21:03:50 UTC (rev 775)
@@ -7,9 +7,6 @@
# GNU Gettext support
LIBS = @LIBINTL@ @LIBS@
-# Define a C macro LOCALEDIR indicating where catalogs will be installed.
-localedir = $(datadir)/locale
-DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
if SOLARIS
SOLFLAGS = -lrt
Modified: GNUnet/src/util/configuration.c
===================================================================
--- GNUnet/src/util/configuration.c 2005-05-11 19:47:25 UTC (rev 774)
+++ GNUnet/src/util/configuration.c 2005-05-11 21:03:50 UTC (rev 775)
@@ -322,7 +322,7 @@
* either in the current section or
* globally FOO is set to DIRECTORY.
*/
-static char * expandDollar(const char * section,
+char * expandDollar(const char * section,
char * orig) {
int i;
char * prefix;
@@ -485,6 +485,9 @@
errexit("Failed to parse configuration file '%s'.\n",
configuration_filename);
parseConfigInit = YES;
+
+ setConfigurationString("", "DATADIR", DATADIR);
+
MUTEX_UNLOCK(&configLock);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r775 - in GNUnet: . contrib contrib/win m4 src/conf src/include src/util,
durner <=