diff --git a/util/LLgen/src/machdep.c b/util/LLgen/src/machdep.c index 0fc29b277..f2d0bd9c1 100644 --- a/util/LLgen/src/machdep.c +++ b/util/LLgen/src/machdep.c @@ -18,7 +18,11 @@ #include #include #include +#if defined WIN32 #include +#else +#include +#endif # include "extern.h" # include "types.h" diff --git a/util/LLgen/src/main.c b/util/LLgen/src/main.c index 8f2a814c3..4cc711323 100644 --- a/util/LLgen/src/main.c +++ b/util/LLgen/src/main.c @@ -374,6 +374,15 @@ void copyto(string target, string source) fclose(ftarget); } +static int isabspath(string path) +{ + if (path[0] == '/') /* Unix paths */ + return 1; + if (path[0] && (path[1] == ':')) /* Windows paths */ + return 1; + return 0; +} + void install(string target, string source) { /* @@ -384,7 +393,7 @@ void install(string target, string source) register int c1, c2; register FILE *f1, *f2; int cnt; - string realtarget = (target[0] != '/') ? aprintf("%s/%s", f_dir, target) : target; + string realtarget = !isabspath(target) ? aprintf("%s/%s", f_dir, target) : target; /* * First open temporary, generated for source