Let the defaut programs depend on the underlying platform
This commit is contained in:
parent
74cc13e057
commit
bf65f88f4b
@ -1,5 +1,5 @@
|
||||
/* $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 program is free software: you can redistribute it and/or modify
|
||||
* 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 */
|
||||
static void _configure_detect(Configure * configure);
|
||||
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,
|
||||
configArray * ca);
|
||||
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);
|
||||
cfgr.prefs = prefs;
|
||||
_configure_detect(&cfgr);
|
||||
_configure_detect_programs(&cfgr);
|
||||
if((ret = _configure_load(prefs, directory, ca)) == 0)
|
||||
{
|
||||
if(prefs->flags & PREFS_n)
|
||||
@ -258,6 +260,33 @@ static HostKernel _detect_kernel(HostOS os, char const * release)
|
||||
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,
|
||||
configArray * ca)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $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 program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -130,6 +130,21 @@ typedef struct _Configure
|
||||
HostArch arch;
|
||||
HostOS os;
|
||||
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;
|
||||
|
||||
|
||||
|
@ -226,9 +226,11 @@ static int _variables_dist(Configure * configure, FILE * fp)
|
||||
configure->prefs->destdir);
|
||||
}
|
||||
_makefile_output_variable(fp, "MKDIR",
|
||||
"mkdir -m 0755 -p");
|
||||
_makefile_output_variable(fp, "INSTALL", "install");
|
||||
_makefile_output_variable(fp, "RM", "rm -f");
|
||||
configure->programs.mkdir);
|
||||
_makefile_output_variable(fp, "INSTALL",
|
||||
configure->programs.install);
|
||||
_makefile_output_variable(fp, "RM",
|
||||
configure->programs.rm);
|
||||
break;
|
||||
}
|
||||
if(c == '\0')
|
||||
@ -370,16 +372,17 @@ static int _variables_executables(Configure * configure, FILE * fp)
|
||||
}
|
||||
if(targets != NULL || includes != NULL || package != NULL)
|
||||
{
|
||||
_makefile_output_variable(fp, "RM", "rm -f");
|
||||
_makefile_output_variable(fp, "LN", "ln -f");
|
||||
_makefile_output_variable(fp, "RM", configure->programs.rm);
|
||||
_makefile_output_variable(fp, "LN", configure->programs.ln);
|
||||
}
|
||||
if(package != NULL)
|
||||
_makefile_output_variable(fp, "TAR", "tar -czvf");
|
||||
_makefile_output_variable(fp, "TAR", configure->programs.tar);
|
||||
if(targets != NULL || includes != NULL)
|
||||
{
|
||||
_makefile_output_variable(fp, "MKDIR",
|
||||
"mkdir -m 0755 -p");
|
||||
_makefile_output_variable(fp, "INSTALL", "install");
|
||||
configure->programs.mkdir);
|
||||
_makefile_output_variable(fp, "INSTALL",
|
||||
configure->programs.install);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -486,7 +489,8 @@ static void _targets_asflags(Configure * configure, FILE * fp)
|
||||
asf = config_get(configure->config, NULL, "asflags");
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -509,7 +513,7 @@ static void _targets_cflags(Configure * configure, FILE * fp)
|
||||
&& cc == NULL)
|
||||
return;
|
||||
if(cc == NULL)
|
||||
_makefile_output_variable(fp, "CC", "cc");
|
||||
_makefile_output_variable(fp, "CC", configure->programs.cc);
|
||||
else
|
||||
_makefile_output_variable(fp, "CC", cc);
|
||||
_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)
|
||||
{
|
||||
_makefile_output_variable(fp, "CXX", "c++");
|
||||
_makefile_output_variable(fp, "CXX", configure->programs.cxx);
|
||||
fprintf(fp, "%s%s", "CXXFLAGSF= ", p);
|
||||
if(configure->os == HO_GNU_LINUX && string_find(p, "-ansi"))
|
||||
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(p == NULL)
|
||||
_makefile_output_variable(fp, "CXX", "c++");
|
||||
_makefile_output_variable(fp, "CXX",
|
||||
configure->programs.cxx);
|
||||
fprintf(fp, "%s%s", "CXXFLAGS= ", q);
|
||||
if(configure->os == HO_GNU_LINUX && string_find(q, "-ansi"))
|
||||
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)
|
||||
{
|
||||
String const * libdir;
|
||||
String const * ccshared = "$(CC) -shared";
|
||||
String const * p;
|
||||
|
||||
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);
|
||||
}
|
||||
if((p = config_get(configure->config, NULL, "ar")) == NULL)
|
||||
_makefile_output_variable(fp, "AR", "ar");
|
||||
_makefile_output_variable(fp, "AR", configure->programs.ar);
|
||||
else
|
||||
_makefile_output_variable(fp, "AR", p);
|
||||
if((p = config_get(configure->config, NULL, "ranlib")) == NULL)
|
||||
_makefile_output_variable(fp, "RANLIB", "ranlib");
|
||||
_makefile_output_variable(fp, "RANLIB",
|
||||
configure->programs.ranlib);
|
||||
else
|
||||
_makefile_output_variable(fp, "RANLIB", p);
|
||||
if((p = config_get(configure->config, NULL, "ld")) == NULL)
|
||||
{
|
||||
if(configure->os == HO_WIN32)
|
||||
ccshared = "$(CC) -shared -Wl,-no-undefined"
|
||||
" -Wl,--enable-runtime-pseudo-reloc";
|
||||
_makefile_output_variable(fp, "CCSHARED", ccshared);
|
||||
}
|
||||
_makefile_output_variable(fp, "CCSHARED",
|
||||
configure->programs.ccshared);
|
||||
else
|
||||
_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((p = config_get(configure->config, NULL, "libtool")) == NULL)
|
||||
_makefile_output_variable(fp, "LIBTOOL", "libtool");
|
||||
_makefile_output_variable(fp, "LIBTOOL",
|
||||
configure->programs.libtool);
|
||||
else
|
||||
_makefile_output_variable(fp, "LIBTOOL", p);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user