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

View File

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