Add configuration of include subdirectories
Add the possibility to search headers in several subdirectories of /usr/local/include and /usr/include. A possible use case would be for tcc to search for headers in /usr/local/include/x86_64-linux-gnu, /usr/local/include, /usr/include/x86_64-linux-gnu and /usr/include in turn.
This commit is contained in:
parent
a6775fc154
commit
4d6a4a26e0
2 changed files with 20 additions and 2 deletions
19
libtcc.c
19
libtcc.c
|
@ -1328,8 +1328,23 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
|
||||||
/* default include paths */
|
/* default include paths */
|
||||||
/* -isystem paths have already been handled */
|
/* -isystem paths have already been handled */
|
||||||
#ifndef TCC_TARGET_PE
|
#ifndef TCC_TARGET_PE
|
||||||
tcc_add_sysinclude_path(s, CONFIG_SYSROOT "/usr/local/include");
|
{
|
||||||
tcc_add_sysinclude_path(s, CONFIG_SYSROOT "/usr/include");
|
int i, nb_extra_incdirs, nb_prefixs;
|
||||||
|
char **extra_incdirs;
|
||||||
|
const char incdir_prefix1[] = CONFIG_SYSROOT "/usr/local/include";
|
||||||
|
const char incdir_prefix2[] = CONFIG_SYSROOT "/usr/include";
|
||||||
|
const char * const incdir_prefixs[] = {incdir_prefix1,
|
||||||
|
incdir_prefix2};
|
||||||
|
|
||||||
|
nb_prefixs = sizeof incdir_prefixs / sizeof *incdir_prefixs;
|
||||||
|
nb_extra_incdirs = tcc_split_path_components(CONFIG_TCC_INCSUBDIR,
|
||||||
|
incdir_prefixs,
|
||||||
|
nb_prefixs,
|
||||||
|
&extra_incdirs);
|
||||||
|
for (i = 0; i < nb_extra_incdirs; i++)
|
||||||
|
tcc_add_sysinclude_path(s, extra_incdirs[i]);
|
||||||
|
dynarray_reset(&extra_incdirs, &nb_extra_incdirs);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
snprintf(buf, sizeof(buf), "%s/include", s->tcc_lib_path);
|
snprintf(buf, sizeof(buf), "%s/include", s->tcc_lib_path);
|
||||||
tcc_add_sysinclude_path(s, buf);
|
tcc_add_sysinclude_path(s, buf);
|
||||||
|
|
3
tcc.h
3
tcc.h
|
@ -150,6 +150,9 @@ typedef int BOOL;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
|
#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
|
||||||
|
#ifndef CONFIG_TCC_INCSUBDIR
|
||||||
|
#define CONFIG_TCC_INCSUBDIR ""
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INCLUDE_STACK_SIZE 32
|
#define INCLUDE_STACK_SIZE 32
|
||||||
#define IFDEF_STACK_SIZE 64
|
#define IFDEF_STACK_SIZE 64
|
||||||
|
|
Loading…
Reference in a new issue