Let more aspects be configured at compile-time

This commit is contained in:
Pierre Pronchery 2017-11-18 01:58:47 +01:00
parent 19401d5887
commit 7d55af9964
2 changed files with 13 additions and 6 deletions

View File

@ -325,7 +325,7 @@ static int _configure_load_config(Configure * configure)
{ {
int ret = 0; int ret = 0;
String const section[] = "programs"; String const section[] = "programs";
String * filename = DATADIR "/" PACKAGE "/" PACKAGE ".conf"; String * filename = DATADIR "/" PACKAGE "/" PACKAGE CONFEXT;
struct struct
{ {
String const * name; String const * name;
@ -350,7 +350,7 @@ static int _configure_load_config(Configure * configure)
if(configure->prefs->basedir != NULL if(configure->prefs->basedir != NULL
&& (filename = string_new_append( && (filename = string_new_append(
configure->prefs->basedir, configure->prefs->basedir,
"/data/" PACKAGE ".conf", "/data/" PACKAGE CONFEXT,
NULL)) == NULL) NULL)) == NULL)
return -configure_error(1, "%s", error_get(NULL)); return -configure_error(1, "%s", error_get(NULL));
if(filename != NULL && config_load(configure->config, filename) != 0) if(filename != NULL && config_load(configure->config, filename) != 0)
@ -362,10 +362,10 @@ static int _configure_load_config(Configure * configure)
if(configure->prefs->basedir != NULL) if(configure->prefs->basedir != NULL)
filename = string_new_append(configure->prefs->basedir, filename = string_new_append(configure->prefs->basedir,
"/data/platform/", sHostOS[configure->os], "/data/platform/", sHostOS[configure->os],
".conf", NULL); CONFEXT, NULL);
else else
filename = string_new_append(DATADIR "/" PACKAGE "/platform/", filename = string_new_append(DATADIR "/" PACKAGE "/platform/",
sHostOS[configure->os], ".conf", NULL); sHostOS[configure->os], CONFEXT, NULL);
if(filename == NULL) if(filename == NULL)
return -configure_error(1, "%s", error_get(NULL)); return -configure_error(1, "%s", error_get(NULL));
else if(config_load(configure->config, filename) != 0) else if(config_load(configure->config, filename) != 0)

View File

@ -121,8 +121,15 @@ extern const struct ExtensionType * sExtensionType;
/* constants */ /* constants */
# define PROJECT_CONF "project.conf" # ifndef CONFEXT
# define CONFEXT ".conf"
# endif
# ifndef PROJECT_CONF
# define PROJECT_CONF "project" CONFEXT
# endif
# ifndef MAKEFILE
# define MAKEFILE "Makefile" # define MAKEFILE "Makefile"
# endif
/* configure */ /* configure */