History

added CPATH, C_INCLUDE_PATH and LD_LIBRARY_PATH

Andrew Aladjev committed 13 years ago

Commit 0ad857c1 parent 0db7f613 files · +21 −0Browse files

Unified · Split

3 files
  1. libtcc.c +18 −0
  2. tcc.c +1 −0
  3. tcc.h +2 −0
libtcc.c+18−0
@@ -1941,3 +1941,21 @@ PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time) · 1940 unmodified lines
19411941 tt, (int)(total_lines / tt),
19421942 total_bytes / tt / 1000000.0);
19431943 }
1944+
1945+PUB_FUNC void tcc_set_environment(TCCState *s)
1946+{
1947+ char * path;
1948+
1949+ path = getenv("C_INCLUDE_PATH");
1950+ if(path != NULL) {
1951+ tcc_add_include_path(s, path);
1952+ }
1953+ path = getenv("CPATH");
1954+ if(path != NULL) {
1955+ tcc_add_include_path(s, path);
1956+ }
1957+ path = getenv("LD_LIBRARY_PATH");
1958+ if(path != NULL) {
1959+ tcc_add_library_path(s, path);
1960+ }
1961+}
tcc.c+1−0
@@ -252,6 +252,7 @@ int main(int argc, char **argv) · 251 unmodified lines
252252 s->output_type = TCC_OUTPUT_EXE;
253253
254254 optind = tcc_parse_args(s, argc - 1, argv + 1);
255+ tcc_set_environment(s);
255256
256257 if (optind == 0) {
257258 help();
tcc.h+2−0
@@ -1061,6 +1061,8 @@ ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags); · 1060 unmodified lines
10611061 PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time);
10621062 PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv);
10631063
1064+PUB_FUNC void tcc_set_environment(TCCState *s);
1065+
10641066 /* ------------ tccpp.c ------------ */
10651067
10661068 ST_DATA struct BufferedFile *file;

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