Unified · Split
| @@ -1941,3 +1941,21 @@ PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time) · 1940 unmodified lines | ||
| 1941 | 1941 | tt, (int)(total_lines / tt), |
| 1942 | 1942 | total_bytes / tt / 1000000.0); |
| 1943 | 1943 | } |
| 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 | +} | |
| @@ -252,6 +252,7 @@ int main(int argc, char **argv) · 251 unmodified lines | ||
| 252 | 252 | s->output_type = TCC_OUTPUT_EXE; |
| 253 | 253 | |
| 254 | 254 | optind = tcc_parse_args(s, argc - 1, argv + 1); |
| 255 | + tcc_set_environment(s); | |
| 255 | 256 | |
| 256 | 257 | if (optind == 0) { |
| 257 | 258 | help(); |
| @@ -1061,6 +1061,8 @@ ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags); · 1060 unmodified lines | ||
| 1061 | 1061 | PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time); |
| 1062 | 1062 | PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv); |
| 1063 | 1063 | |
| 1064 | +PUB_FUNC void tcc_set_environment(TCCState *s); | |
| 1065 | + | |
| 1064 | 1066 | /* ------------ tccpp.c ------------ */ |
| 1065 | 1067 | |
| 1066 | 1068 | ST_DATA struct BufferedFile *file; |