Using PROGNAME instead of PACKAGE for configure(1)

This commit is contained in:
Pierre Pronchery 2014-10-03 13:27:51 +02:00
parent 08d51a9edf
commit ed1cc6d820
2 changed files with 29 additions and 21 deletions

View File

@ -29,6 +29,10 @@
#include "configure.h" #include "configure.h"
#include "../config.h" #include "../config.h"
#ifndef PROGNAME
# define PROGNAME PACKAGE
#endif
/* configure */ /* configure */
/* constants */ /* constants */
@ -108,7 +112,7 @@ ObjectType _source_type(String const * source);
/* configure_error */ /* configure_error */
int configure_error(char const * message, int ret) int configure_error(char const * message, int ret)
{ {
fputs(PACKAGE ": ", stderr); fputs(PROGNAME ": ", stderr);
perror(message); perror(message);
return ret; return ret;
} }
@ -176,7 +180,7 @@ static int _configure(Prefs * prefs, char const * directory)
Config * p; Config * p;
if((ca = configarray_new()) == NULL) if((ca = configarray_new()) == NULL)
return error_print(PACKAGE); return error_print(PROGNAME);
cfgr.prefs = prefs; cfgr.prefs = prefs;
_configure_detect(&cfgr); _configure_detect(&cfgr);
_configure_detect_programs(&cfgr); _configure_detect_programs(&cfgr);
@ -308,7 +312,7 @@ static int _configure_load(Prefs * prefs, String const * directory,
if(prefs->flags & PREFS_v) if(prefs->flags & PREFS_v)
printf("%s%s%s", "Loading project file ", path, "\n"); printf("%s%s%s", "Loading project file ", path, "\n");
if(config_load(config, path) != 0) if(config_load(config, path) != 0)
ret = error_print(PACKAGE); ret = error_print(PROGNAME);
else else
{ {
array_append(ca, &config); array_append(ca, &config);

View File

@ -26,6 +26,10 @@
#include "configure.h" #include "configure.h"
#include "../config.h" #include "../config.h"
#ifndef PROGNAME
# define PROGNAME PACKAGE
#endif
/* prototypes */ /* prototypes */
static int _makefile_output_variable(FILE * fp, char const * name, static int _makefile_output_variable(FILE * fp, char const * name,
@ -141,7 +145,7 @@ static int _variables_package(Configure * configure, FILE * fp,
{ {
if(configure->prefs->flags & PREFS_v) if(configure->prefs->flags & PREFS_v)
fputc('\n', stdout); fputc('\n', stdout);
fprintf(stderr, "%s%s%s", PACKAGE ": ", directory, fprintf(stderr, "%s%s%s", PROGNAME ": ", directory,
": \"package\" needs \"version\"\n"); ": \"package\" needs \"version\"\n");
return 1; return 1;
} }
@ -823,7 +827,7 @@ static int _targets_target(Configure * configure, FILE * fp,
if((type = config_get(configure->config, target, "type")) == NULL) if((type = config_get(configure->config, target, "type")) == NULL)
{ {
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": no type defined for target\n"); ": no type defined for target\n");
return 1; return 1;
} }
@ -843,7 +847,7 @@ static int _targets_target(Configure * configure, FILE * fp,
case TT_SCRIPT: case TT_SCRIPT:
return _target_script(configure, fp, target); return _target_script(configure, fp, target);
case TT_UNKNOWN: case TT_UNKNOWN:
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": unknown type for target\n"); ": unknown type for target\n");
return 1; return 1;
} }
@ -900,7 +904,7 @@ static int _objs_source(Prefs * prefs, FILE * fp, String * source,
if((extension = _source_extension(source)) == NULL) if((extension = _source_extension(source)) == NULL)
{ {
fprintf(stderr, "%s%s%s", PACKAGE ": ", source, fprintf(stderr, "%s%s%s", PROGNAME ": ", source,
": no extension for source\n"); ": no extension for source\n");
return 1; return 1;
} }
@ -918,7 +922,7 @@ static int _objs_source(Prefs * prefs, FILE * fp, String * source,
break; break;
case OT_UNKNOWN: case OT_UNKNOWN:
ret = 1; ret = 1;
fprintf(stderr, "%s%s%s", PACKAGE ": ", source, fprintf(stderr, "%s%s%s", PROGNAME ": ", source,
": unknown extension for source\n"); ": unknown extension for source\n");
break; break;
} }
@ -948,7 +952,7 @@ static int _target_binary(Configure * configure, FILE * fp,
|| string_replace(&q, ",", " ") != 0) || string_replace(&q, ",", " ") != 0)
{ {
string_delete(q); string_delete(q);
return error_print(PACKAGE); return error_print(PROGNAME);
} }
fprintf(fp, " %s", q); fprintf(fp, " %s", q);
string_delete(q); string_delete(q);
@ -1163,13 +1167,13 @@ static int _target_object(Configure * configure, FILE * fp,
if((p = config_get(configure->config, target, "sources")) == NULL) if((p = config_get(configure->config, target, "sources")) == NULL)
{ {
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": No sources for target\n"); ": No sources for target\n");
return 1; return 1;
} }
if(strchr(p, ',') != NULL) if(strchr(p, ',') != NULL)
{ {
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": An object can have only one source file\n"); ": An object can have only one source file\n");
return 1; return 1;
} }
@ -1209,7 +1213,7 @@ static int _target_object(Configure * configure, FILE * fp,
fputc('\n', fp); fputc('\n', fp);
break; break;
case OT_UNKNOWN: case OT_UNKNOWN:
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": Unknown source type for object\n"); ": Unknown source type for object\n");
return 1; return 1;
} }
@ -1287,12 +1291,12 @@ static int _target_script(Configure * configure, FILE * fp,
if((script = config_get(configure->config, target, "script")) == NULL) if((script = config_get(configure->config, target, "script")) == NULL)
{ {
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": No script for target\n"); ": No script for target\n");
return 1; return 1;
} }
if(configure->prefs->flags & PREFS_S) if(configure->prefs->flags & PREFS_S)
error_set_print(PACKAGE, 0, "%s: %s%s%s", target, "The \"", error_set_print(PROGNAME, 0, "%s: %s%s%s", target, "The \"",
script, script,
"\" script is executed while compiling"); "\" script is executed while compiling");
if(configure->prefs->flags & PREFS_n) if(configure->prefs->flags & PREFS_n)
@ -1482,7 +1486,7 @@ static int _target_source(Configure * configure, FILE * fp,
fputc('\n', fp); fputc('\n', fp);
break; break;
case OT_UNKNOWN: case OT_UNKNOWN:
fprintf(stderr, "%s%s%s", PACKAGE ": ", target, fprintf(stderr, "%s%s%s", PROGNAME ": ", target,
": Unknown source type for object\n"); ": Unknown source type for object\n");
ret = 1; ret = 1;
break; break;
@ -2021,22 +2025,22 @@ static int _dist_check(Configure * configure, char const * target,
m = strtol(mode, &p, 8); m = strtol(mode, &p, 8);
if(mode[0] == '\0' || *p != '\0') if(mode[0] == '\0' || *p != '\0')
return error_set_print(PACKAGE, 1, "%s: %s%s%s", target, return error_set_print(PROGNAME, 1, "%s: %s%s%s", target,
"Invalid permissions \"", mode, "\""); "Invalid permissions \"", mode, "\"");
if((configure->prefs->flags & PREFS_S) && (m & 04000)) if((configure->prefs->flags & PREFS_S) && (m & 04000))
error_set_print(PACKAGE, 0, "%s: %s", target, error_set_print(PROGNAME, 0, "%s: %s", target,
"Installed as a SUID file"); "Installed as a SUID file");
if((configure->prefs->flags & PREFS_S) && (m & 04000)) if((configure->prefs->flags & PREFS_S) && (m & 04000))
error_set_print(PACKAGE, 0, "%s: %s", target, error_set_print(PROGNAME, 0, "%s: %s", target,
"Installed as a SGID file"); "Installed as a SGID file");
if((configure->prefs->flags & PREFS_S) && (m & 0111)) if((configure->prefs->flags & PREFS_S) && (m & 0111))
error_set_print(PACKAGE, 0, "%s: %s", target, error_set_print(PROGNAME, 0, "%s: %s", target,
"Installed as an executable file"); "Installed as an executable file");
if((configure->prefs->flags & PREFS_S) && (m & 0020)) if((configure->prefs->flags & PREFS_S) && (m & 0020))
error_set_print(PACKAGE, 0, "%s: %s", target, error_set_print(PROGNAME, 0, "%s: %s", target,
"Installed as a group-writable file"); "Installed as a group-writable file");
if((configure->prefs->flags & PREFS_S) && (m & 0002)) if((configure->prefs->flags & PREFS_S) && (m & 0002))
error_set_print(PACKAGE, 0, "%s: %s", target, error_set_print(PROGNAME, 0, "%s: %s", target,
"Installed as a writable file"); "Installed as a writable file");
return 0; return 0;
} }