History

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.

Thomas Preud'homme committed 15 years ago

Commit 4d6a4a21 parent a6775fc2 files · +20 −2Browse files

Unified · Split

2 files
  1. libtcc.c +17 −2
  2. tcc.h +3 −0
libtcc.c+17−2
@@ -1328,8 +1328,23 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 1327 unmodified lines
1328 /* default include paths */1328 /* default include paths */
1329 /* -isystem paths have already been handled */1329 /* -isystem paths have already been handled */
1330#ifndef TCC_TARGET_PE1330#ifndef TCC_TARGET_PE
1331 tcc_add_sysinclude_path(s, CONFIG_SYSROOT "/usr/local/include");1331 {
1332 tcc_add_sysinclude_path(s, CONFIG_SYSROOT "/usr/include");1332 int i, nb_extra_incdirs, nb_prefixs;
1333 char **extra_incdirs;
1334 const char incdir_prefix1[] = CONFIG_SYSROOT "/usr/local/include";
1335 const char incdir_prefix2[] = CONFIG_SYSROOT "/usr/include";
1336 const char * const incdir_prefixs[] = {incdir_prefix1,
1337 incdir_prefix2};
1338
1339 nb_prefixs = sizeof incdir_prefixs / sizeof *incdir_prefixs;
1340 nb_extra_incdirs = tcc_split_path_components(CONFIG_TCC_INCSUBDIR,
1341 incdir_prefixs,
1342 nb_prefixs,
1343 &extra_incdirs);
1344 for (i = 0; i < nb_extra_incdirs; i++)
1345 tcc_add_sysinclude_path(s, extra_incdirs[i]);
1346 dynarray_reset(&extra_incdirs, &nb_extra_incdirs);
1347 }
1333#endif1348#endif
1334 snprintf(buf, sizeof(buf), "%s/include", s->tcc_lib_path);1349 snprintf(buf, sizeof(buf), "%s/include", s->tcc_lib_path);
1335 tcc_add_sysinclude_path(s, buf);1350 tcc_add_sysinclude_path(s, buf);
tcc.h+3−0
@@ -150,6 +150,9 @@ typedef int BOOL; · 149 unmodified lines
150 #endif150 #endif
151#endif151#endif
152#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR152#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
153#ifndef CONFIG_TCC_INCSUBDIR
154 #define CONFIG_TCC_INCSUBDIR ""
155#endif
153 156
154#define INCLUDE_STACK_SIZE 32157#define INCLUDE_STACK_SIZE 32
155#define IFDEF_STACK_SIZE 64158#define IFDEF_STACK_SIZE 64

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t