Let the defaut programs depend on the underlying platform
This commit is contained in:
parent
74cc13e057
commit
bf65f88f4b
@ -1,5 +1,5 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2004-2012 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2004-2013 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Devel configure */
|
/* This file is part of DeforaOS Devel configure */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -157,6 +157,7 @@ unsigned int enum_string_short(unsigned int last, const String * strings[],
|
|||||||
/* configure */
|
/* configure */
|
||||||
static void _configure_detect(Configure * configure);
|
static void _configure_detect(Configure * configure);
|
||||||
static HostKernel _detect_kernel(HostOS os, char const * release);
|
static HostKernel _detect_kernel(HostOS os, char const * release);
|
||||||
|
static void _configure_detect_programs(Configure * configure);
|
||||||
static int _configure_load(Prefs * prefs, char const * directory,
|
static int _configure_load(Prefs * prefs, char const * directory,
|
||||||
configArray * ca);
|
configArray * ca);
|
||||||
static int _load_subdirs(Prefs * prefs, char const * directory,
|
static int _load_subdirs(Prefs * prefs, char const * directory,
|
||||||
@ -178,6 +179,7 @@ static int _configure(Prefs * prefs, char const * directory)
|
|||||||
return error_print(PACKAGE);
|
return error_print(PACKAGE);
|
||||||
cfgr.prefs = prefs;
|
cfgr.prefs = prefs;
|
||||||
_configure_detect(&cfgr);
|
_configure_detect(&cfgr);
|
||||||
|
_configure_detect_programs(&cfgr);
|
||||||
if((ret = _configure_load(prefs, directory, ca)) == 0)
|
if((ret = _configure_load(prefs, directory, ca)) == 0)
|
||||||
{
|
{
|
||||||
if(prefs->flags & PREFS_n)
|
if(prefs->flags & PREFS_n)
|
||||||
@ -258,6 +260,33 @@ static HostKernel _detect_kernel(HostOS os, char const * release)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _configure_detect_programs(Configure * configure)
|
||||||
|
{
|
||||||
|
configure->programs.ar = "ar";
|
||||||
|
configure->programs.as = "as";
|
||||||
|
configure->programs.cc = "cc";
|
||||||
|
configure->programs.ccshared = "$(CC) -shared";
|
||||||
|
configure->programs.cxx = "c++";
|
||||||
|
configure->programs.install = "install";
|
||||||
|
configure->programs.libtool = "libtool";
|
||||||
|
configure->programs.ln = "ln -f";
|
||||||
|
configure->programs.mkdir = "mkdir -m 0755 -p";
|
||||||
|
configure->programs.ranlib = "ranlib";
|
||||||
|
configure->programs.rm = "rm -f";
|
||||||
|
configure->programs.tar = "tar -czvf";
|
||||||
|
/* platform-specific */
|
||||||
|
switch(configure->os)
|
||||||
|
{
|
||||||
|
case HO_WIN32:
|
||||||
|
configure->programs.ccshared = "$(CC) -shared"
|
||||||
|
" -Wl,-no-undefined"
|
||||||
|
" -Wl,--enable-runtime-pseudo-reloc";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int _configure_load(Prefs * prefs, String const * directory,
|
static int _configure_load(Prefs * prefs, String const * directory,
|
||||||
configArray * ca)
|
configArray * ca)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2006-2012 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2006-2013 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Devel configure */
|
/* This file is part of DeforaOS Devel configure */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -130,6 +130,21 @@ typedef struct _Configure
|
|||||||
HostArch arch;
|
HostArch arch;
|
||||||
HostOS os;
|
HostOS os;
|
||||||
HostKernel kernel;
|
HostKernel kernel;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char const * ar;
|
||||||
|
char const * as;
|
||||||
|
char const * cc;
|
||||||
|
char const * ccshared;
|
||||||
|
char const * cxx;
|
||||||
|
char const * install;
|
||||||
|
char const * libtool;
|
||||||
|
char const * ln;
|
||||||
|
char const * mkdir;
|
||||||
|
char const * ranlib;
|
||||||
|
char const * rm;
|
||||||
|
char const * tar;
|
||||||
|
} programs;
|
||||||
} Configure;
|
} Configure;
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,9 +226,11 @@ static int _variables_dist(Configure * configure, FILE * fp)
|
|||||||
configure->prefs->destdir);
|
configure->prefs->destdir);
|
||||||
}
|
}
|
||||||
_makefile_output_variable(fp, "MKDIR",
|
_makefile_output_variable(fp, "MKDIR",
|
||||||
"mkdir -m 0755 -p");
|
configure->programs.mkdir);
|
||||||
_makefile_output_variable(fp, "INSTALL", "install");
|
_makefile_output_variable(fp, "INSTALL",
|
||||||
_makefile_output_variable(fp, "RM", "rm -f");
|
configure->programs.install);
|
||||||
|
_makefile_output_variable(fp, "RM",
|
||||||
|
configure->programs.rm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
@ -370,16 +372,17 @@ static int _variables_executables(Configure * configure, FILE * fp)
|
|||||||
}
|
}
|
||||||
if(targets != NULL || includes != NULL || package != NULL)
|
if(targets != NULL || includes != NULL || package != NULL)
|
||||||
{
|
{
|
||||||
_makefile_output_variable(fp, "RM", "rm -f");
|
_makefile_output_variable(fp, "RM", configure->programs.rm);
|
||||||
_makefile_output_variable(fp, "LN", "ln -f");
|
_makefile_output_variable(fp, "LN", configure->programs.ln);
|
||||||
}
|
}
|
||||||
if(package != NULL)
|
if(package != NULL)
|
||||||
_makefile_output_variable(fp, "TAR", "tar -czvf");
|
_makefile_output_variable(fp, "TAR", configure->programs.tar);
|
||||||
if(targets != NULL || includes != NULL)
|
if(targets != NULL || includes != NULL)
|
||||||
{
|
{
|
||||||
_makefile_output_variable(fp, "MKDIR",
|
_makefile_output_variable(fp, "MKDIR",
|
||||||
"mkdir -m 0755 -p");
|
configure->programs.mkdir);
|
||||||
_makefile_output_variable(fp, "INSTALL", "install");
|
_makefile_output_variable(fp, "INSTALL",
|
||||||
|
configure->programs.install);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -486,7 +489,8 @@ static void _targets_asflags(Configure * configure, FILE * fp)
|
|||||||
asf = config_get(configure->config, NULL, "asflags");
|
asf = config_get(configure->config, NULL, "asflags");
|
||||||
if(as != NULL || asf != NULL)
|
if(as != NULL || asf != NULL)
|
||||||
{
|
{
|
||||||
_makefile_output_variable(fp, "AS", (as != NULL) ? as : "as");
|
_makefile_output_variable(fp, "AS", (as != NULL) ? as
|
||||||
|
: configure->programs.as);
|
||||||
_makefile_output_variable(fp, "ASFLAGS", asf);
|
_makefile_output_variable(fp, "ASFLAGS", asf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,7 +513,7 @@ static void _targets_cflags(Configure * configure, FILE * fp)
|
|||||||
&& cc == NULL)
|
&& cc == NULL)
|
||||||
return;
|
return;
|
||||||
if(cc == NULL)
|
if(cc == NULL)
|
||||||
_makefile_output_variable(fp, "CC", "cc");
|
_makefile_output_variable(fp, "CC", configure->programs.cc);
|
||||||
else
|
else
|
||||||
_makefile_output_variable(fp, "CC", cc);
|
_makefile_output_variable(fp, "CC", cc);
|
||||||
_makefile_output_variable(fp, "CPPFLAGSF", cppf);
|
_makefile_output_variable(fp, "CPPFLAGSF", cppf);
|
||||||
@ -533,7 +537,7 @@ static void _targets_cxxflags(Configure * configure, FILE * fp)
|
|||||||
|
|
||||||
if((p = config_get(configure->config, NULL, "cxxflags_force")) != NULL)
|
if((p = config_get(configure->config, NULL, "cxxflags_force")) != NULL)
|
||||||
{
|
{
|
||||||
_makefile_output_variable(fp, "CXX", "c++");
|
_makefile_output_variable(fp, "CXX", configure->programs.cxx);
|
||||||
fprintf(fp, "%s%s", "CXXFLAGSF= ", p);
|
fprintf(fp, "%s%s", "CXXFLAGSF= ", p);
|
||||||
if(configure->os == HO_GNU_LINUX && string_find(p, "-ansi"))
|
if(configure->os == HO_GNU_LINUX && string_find(p, "-ansi"))
|
||||||
fprintf(fp, "%s", " -D _GNU_SOURCE");
|
fprintf(fp, "%s", " -D _GNU_SOURCE");
|
||||||
@ -542,7 +546,8 @@ static void _targets_cxxflags(Configure * configure, FILE * fp)
|
|||||||
if((q = config_get(configure->config, NULL, "cxxflags")) != NULL)
|
if((q = config_get(configure->config, NULL, "cxxflags")) != NULL)
|
||||||
{
|
{
|
||||||
if(p == NULL)
|
if(p == NULL)
|
||||||
_makefile_output_variable(fp, "CXX", "c++");
|
_makefile_output_variable(fp, "CXX",
|
||||||
|
configure->programs.cxx);
|
||||||
fprintf(fp, "%s%s", "CXXFLAGS= ", q);
|
fprintf(fp, "%s%s", "CXXFLAGS= ", q);
|
||||||
if(configure->os == HO_GNU_LINUX && string_find(q, "-ansi"))
|
if(configure->os == HO_GNU_LINUX && string_find(q, "-ansi"))
|
||||||
fprintf(fp, "%s", " -D _GNU_SOURCE");
|
fprintf(fp, "%s", " -D _GNU_SOURCE");
|
||||||
@ -647,7 +652,6 @@ static void _binary_ldflags(Configure * configure, FILE * fp,
|
|||||||
static void _variables_library(Configure * configure, FILE * fp, char * done)
|
static void _variables_library(Configure * configure, FILE * fp, char * done)
|
||||||
{
|
{
|
||||||
String const * libdir;
|
String const * libdir;
|
||||||
String const * ccshared = "$(CC) -shared";
|
|
||||||
String const * p;
|
String const * p;
|
||||||
|
|
||||||
if(!done[TT_LIBRARY] && !done[TT_SCRIPT])
|
if(!done[TT_LIBRARY] && !done[TT_SCRIPT])
|
||||||
@ -672,20 +676,17 @@ static void _variables_library(Configure * configure, FILE * fp, char * done)
|
|||||||
_targets_exeext(configure, fp);
|
_targets_exeext(configure, fp);
|
||||||
}
|
}
|
||||||
if((p = config_get(configure->config, NULL, "ar")) == NULL)
|
if((p = config_get(configure->config, NULL, "ar")) == NULL)
|
||||||
_makefile_output_variable(fp, "AR", "ar");
|
_makefile_output_variable(fp, "AR", configure->programs.ar);
|
||||||
else
|
else
|
||||||
_makefile_output_variable(fp, "AR", p);
|
_makefile_output_variable(fp, "AR", p);
|
||||||
if((p = config_get(configure->config, NULL, "ranlib")) == NULL)
|
if((p = config_get(configure->config, NULL, "ranlib")) == NULL)
|
||||||
_makefile_output_variable(fp, "RANLIB", "ranlib");
|
_makefile_output_variable(fp, "RANLIB",
|
||||||
|
configure->programs.ranlib);
|
||||||
else
|
else
|
||||||
_makefile_output_variable(fp, "RANLIB", p);
|
_makefile_output_variable(fp, "RANLIB", p);
|
||||||
if((p = config_get(configure->config, NULL, "ld")) == NULL)
|
if((p = config_get(configure->config, NULL, "ld")) == NULL)
|
||||||
{
|
_makefile_output_variable(fp, "CCSHARED",
|
||||||
if(configure->os == HO_WIN32)
|
configure->programs.ccshared);
|
||||||
ccshared = "$(CC) -shared -Wl,-no-undefined"
|
|
||||||
" -Wl,--enable-runtime-pseudo-reloc";
|
|
||||||
_makefile_output_variable(fp, "CCSHARED", ccshared);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
_makefile_output_variable(fp, "CCSHARED", p);
|
_makefile_output_variable(fp, "CCSHARED", p);
|
||||||
}
|
}
|
||||||
@ -698,7 +699,8 @@ static void _variables_libtool(Configure * configure, FILE * fp, char * done)
|
|||||||
if(!done[TT_LIBTOOL])
|
if(!done[TT_LIBTOOL])
|
||||||
{
|
{
|
||||||
if((p = config_get(configure->config, NULL, "libtool")) == NULL)
|
if((p = config_get(configure->config, NULL, "libtool")) == NULL)
|
||||||
_makefile_output_variable(fp, "LIBTOOL", "libtool");
|
_makefile_output_variable(fp, "LIBTOOL",
|
||||||
|
configure->programs.libtool);
|
||||||
else
|
else
|
||||||
_makefile_output_variable(fp, "LIBTOOL", p);
|
_makefile_output_variable(fp, "LIBTOOL", p);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user