Fix tix-build honoring empty triplet variables.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-04-24 18:56:57 +02:00
parent b2addd979c
commit dd26ee724a
2 changed files with 9 additions and 2 deletions

View File

@ -868,9 +868,9 @@ int main(int argc, char* argv[])
if ( !minfo.build && !(minfo.build = GetBuildTriplet()) )
error(1, errno, "unable to determine build, use --build or BUILD");
if ( !minfo.host && !(minfo.host = strdup_null(getenv("HOST"))) )
if ( !minfo.host && !(minfo.host = strdup_null_if_content(getenv("HOST"))) )
minfo.host = strdup(minfo.build);
if ( !minfo.target && !(minfo.target = strdup_null(getenv("TARGET"))) )
if ( !minfo.target && !(minfo.target = strdup_null_if_content(getenv("TARGET"))) )
minfo.target = strdup(minfo.host);
if ( minfo.prefix && !minfo.exec_prefix )

View File

@ -75,6 +75,13 @@ char* strdup_null(const char* src)
return src ? strdup(src) : NULL;
}
char* strdup_null_if_content(const char* src)
{
if ( src && !src[0] )
return NULL;
return strdup_null(src);
}
const char* non_modify_basename(const char* path)
{
const char* last_slash = (char*) strrchr((char*) path, '/');