diff options
Diffstat (limited to 'src/config.c')
| -rw-r--r-- | src/config.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c index 9c885ff..6e4b84f 100644 --- a/src/config.c +++ b/src/config.c @@ -339,9 +339,18 @@ static int add_include_path(ccdjit_context *ctx, const char *path) { return ECEX_ERR; } +static int add_existing_include_path(ccdjit_context *ctx, const char *path) { + if (!path || !path[0] || !ecex_path_is_dir(path)) return ECEX_OK; + return add_include_path(ctx, path); +} + int ecex_add_ccdjit_include_paths(ccdjit_context *ctx) { - if (add_include_path(ctx, "include") != ECEX_OK) return ECEX_ERR; - if (add_include_path(ctx, "../include") != ECEX_OK) return ECEX_ERR; + if (add_existing_include_path(ctx, "include") != ECEX_OK) return ECEX_ERR; + if (add_existing_include_path(ctx, "../include") != ECEX_OK) return ECEX_ERR; + +#ifdef ECEX_SYSTEM_INCLUDE_DIR + if (add_existing_include_path(ctx, ECEX_SYSTEM_INCLUDE_DIR) != ECEX_OK) return ECEX_ERR; +#endif const char *env_include = getenv("ECEX_INCLUDE"); if (env_include && env_include[0]) { |
