Let the Configure instance be private (2/3)
This commit is contained in:
parent
9142061d75
commit
8a14bdbdc7
@ -203,8 +203,7 @@ static int _variables_package(Configure * configure, FILE * fp,
|
|||||||
_makefile_output_variable(fp, "PACKAGE", package);
|
_makefile_output_variable(fp, "PACKAGE", package);
|
||||||
_makefile_output_variable(fp, "VERSION", version);
|
_makefile_output_variable(fp, "VERSION", version);
|
||||||
if((p = _makefile_get_config(configure, NULL, "config")) != NULL)
|
if((p = _makefile_get_config(configure, NULL, "config")) != NULL)
|
||||||
return settings(configure_get_prefs(configure),
|
return settings(configure, directory, package, version);
|
||||||
configure->config, directory, package, version);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,12 +51,11 @@ String * sSettingsType[ST_COUNT] =
|
|||||||
|
|
||||||
/* functions */
|
/* functions */
|
||||||
/* settings */
|
/* settings */
|
||||||
static int _settings_do(ConfigurePrefs const * prefs, Config const * config,
|
static int _settings_do(Configure * configure, String const * directory,
|
||||||
String const * directory, String const * package,
|
String const * package, String const * version,
|
||||||
String const * version, String const * extension);
|
String const * extension);
|
||||||
|
|
||||||
int settings(ConfigurePrefs const * prefs, Config const * config,
|
int settings(Configure * configure, String const * directory,
|
||||||
String const * directory,
|
|
||||||
String const * package, String const * version)
|
String const * package, String const * version)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -66,7 +65,7 @@ int settings(ConfigurePrefs const * prefs, Config const * config,
|
|||||||
unsigned long i;
|
unsigned long i;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if((p = config_get(config, "", "config")) == NULL)
|
if((p = configure_get_config(configure, "", "config")) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if((q = string_new(p)) == NULL)
|
if((q = string_new(p)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@ -77,8 +76,7 @@ int settings(ConfigurePrefs const * prefs, Config const * config,
|
|||||||
continue;
|
continue;
|
||||||
c = r[i];
|
c = r[i];
|
||||||
r[i] = '\0';
|
r[i] = '\0';
|
||||||
ret |= _settings_do(prefs, config, directory, package, version,
|
ret |= _settings_do(configure, directory, package, version, r);
|
||||||
r);
|
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
break;
|
break;
|
||||||
r+=i+1;
|
r+=i+1;
|
||||||
@ -88,13 +86,13 @@ int settings(ConfigurePrefs const * prefs, Config const * config,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _do_h(ConfigurePrefs const * prefs, Config const * config, FILE * fp,
|
static int _do_h(Configure * configure, FILE * fp,
|
||||||
String const * package, String const * version);
|
String const * package, String const * version);
|
||||||
static int _do_sh(ConfigurePrefs const * prefs, Config const * config,
|
static int _do_sh(Configure * configure, FILE * fp,
|
||||||
FILE * fp, String const * package, String const * version);
|
String const * package, String const * version);
|
||||||
static int _settings_do(ConfigurePrefs const * prefs, Config const * config,
|
static int _settings_do(Configure * configure, String const * directory,
|
||||||
String const * directory, String const * package,
|
String const * package, String const * version,
|
||||||
String const * version, String const * extension)
|
String const * extension)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -110,7 +108,7 @@ static int _settings_do(ConfigurePrefs const * prefs, Config const * config,
|
|||||||
": Unknown settings type\n");
|
": Unknown settings type\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(prefs->flags & PREFS_n)
|
if(configure_is_flag_set(configure, PREFS_n))
|
||||||
return 0;
|
return 0;
|
||||||
if((filename = string_new(directory)) == NULL)
|
if((filename = string_new(directory)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@ -125,35 +123,39 @@ static int _settings_do(ConfigurePrefs const * prefs, Config const * config,
|
|||||||
string_delete(filename);
|
string_delete(filename);
|
||||||
if(fp == NULL)
|
if(fp == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
if(prefs->flags & PREFS_v)
|
if(configure_is_flag_set(configure, PREFS_v))
|
||||||
printf("%s%s/%s%s\n", "Creating ", directory, "config.",
|
printf("%s%s/%s%s\n", "Creating ", directory, "config.",
|
||||||
extension);
|
extension);
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ST_H:
|
case ST_H:
|
||||||
ret |= _do_h(prefs, config, fp, package, version);
|
ret |= _do_h(configure, fp, package, version);
|
||||||
break;
|
break;
|
||||||
case ST_SH:
|
case ST_SH:
|
||||||
ret |= _do_sh(prefs, config, fp, package, version);
|
ret |= _do_sh(configure, fp, package, version);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _do_h(ConfigurePrefs const * prefs, Config const * config, FILE * fp,
|
static int _do_h(Configure * configure, FILE * fp,
|
||||||
String const * package, String const * version)
|
String const * package, String const * version)
|
||||||
{
|
{
|
||||||
|
ConfigurePrefs const * prefs;
|
||||||
char const * p;
|
char const * p;
|
||||||
|
|
||||||
|
prefs = configure_get_prefs(configure);
|
||||||
fprintf(fp, "%s%s%s%s%s%s", "#define PACKAGE \"", package, "\"\n",
|
fprintf(fp, "%s%s%s%s%s%s", "#define PACKAGE \"", package, "\"\n",
|
||||||
"#define VERSION \"", version, "\"\n");
|
"#define VERSION \"", version, "\"\n");
|
||||||
if((p = prefs->prefix) != NULL
|
if((p = prefs->prefix) != NULL
|
||||||
|| (p = config_get(config, "", "prefix")) != NULL)
|
|| (p = configure_get_config(configure, "",
|
||||||
|
"prefix")) != NULL)
|
||||||
fprintf(fp, "%s%s%s", "\n#ifndef PREFIX\n\
|
fprintf(fp, "%s%s%s", "\n#ifndef PREFIX\n\
|
||||||
# define PREFIX \"", p, "\"\n#endif\n");
|
# define PREFIX \"", p, "\"\n#endif\n");
|
||||||
if((p = prefs->libdir) != NULL
|
if((p = prefs->libdir) != NULL
|
||||||
|| (p = config_get(config, "", "libdir")) != NULL)
|
|| (p = configure_get_config(configure, "",
|
||||||
|
"libdir")) != NULL)
|
||||||
{
|
{
|
||||||
fprintf(fp, "%s", "\n#ifndef LIBDIR\n# define LIBDIR ");
|
fprintf(fp, "%s", "\n#ifndef LIBDIR\n# define LIBDIR ");
|
||||||
fprintf(fp, "%s%s", p[0] == '/' ? "\"" : "PREFIX \"/", p);
|
fprintf(fp, "%s%s", p[0] == '/' ? "\"" : "PREFIX \"/", p);
|
||||||
@ -162,18 +164,22 @@ static int _do_h(ConfigurePrefs const * prefs, Config const * config, FILE * fp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _do_sh(ConfigurePrefs const * prefs, Config const * config,
|
static int _do_sh(Configure * configure, FILE * fp,
|
||||||
FILE * fp, String const * package, String const * version)
|
String const * package, String const * version)
|
||||||
{
|
{
|
||||||
|
ConfigurePrefs const * prefs;
|
||||||
char const * p;
|
char const * p;
|
||||||
|
|
||||||
|
prefs = configure_get_prefs(configure);
|
||||||
fprintf(fp, "%s%s%s%s%s%s", "PACKAGE=\"", package, "\"\n",
|
fprintf(fp, "%s%s%s%s%s%s", "PACKAGE=\"", package, "\"\n",
|
||||||
"VERSION=\"", version, "\"\n");
|
"VERSION=\"", version, "\"\n");
|
||||||
if((p = prefs->prefix) != NULL
|
if((p = prefs->prefix) != NULL
|
||||||
|| (p = config_get(config, "", "prefix")) != NULL)
|
|| (p = configure_get_config(configure, "",
|
||||||
|
"prefix")) != NULL)
|
||||||
fprintf(fp, "%s%s%s", "\nPREFIX=\"", p, "\"\n");
|
fprintf(fp, "%s%s%s", "\nPREFIX=\"", p, "\"\n");
|
||||||
if((p = prefs->libdir) != NULL
|
if((p = prefs->libdir) != NULL
|
||||||
|| (p = config_get(config, "", "libdir")) != NULL)
|
|| (p = configure_get_config(configure, "",
|
||||||
|
"libdir")) != NULL)
|
||||||
fprintf(fp, "%s%s%s%s", "LIBDIR=\"", p[0] == '/' ? ""
|
fprintf(fp, "%s%s%s%s", "LIBDIR=\"", p[0] == '/' ? ""
|
||||||
: "${PREFIX}/", p, "\"\n");
|
: "${PREFIX}/", p, "\"\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -36,8 +36,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* functions */
|
/* functions */
|
||||||
int settings(ConfigurePrefs const * prefs, Config const * config,
|
int settings(Configure * configure, String const * directory,
|
||||||
String const * directory,
|
|
||||||
String const * package, String const * version);
|
String const * package, String const * version);
|
||||||
|
|
||||||
#endif /* !CONFIGURE_SETTINGS_H */
|
#endif /* !CONFIGURE_SETTINGS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user