diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-05-03 06:20:12 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-05-03 06:20:12 +0000 |
commit | b35cf07aac65df84bf9b0006798080e6a264323f (patch) | |
tree | 010cb7eb3b9f8d4826e33a5dd835c1c4212efbfd /extra/gcc-uClibc/gcc-uClibc.c | |
parent | fe59e884939be00a0bbdc42add4076f23d2f3323 (diff) |
Avoid needing to distinguis between the install dir and the build
dir. Use both automagically when compiling.
-Erik
Diffstat (limited to 'extra/gcc-uClibc/gcc-uClibc.c')
-rw-r--r-- | extra/gcc-uClibc/gcc-uClibc.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/extra/gcc-uClibc/gcc-uClibc.c b/extra/gcc-uClibc/gcc-uClibc.c index 42c8d5aad..1a0eb1da7 100644 --- a/extra/gcc-uClibc/gcc-uClibc.c +++ b/extra/gcc-uClibc/gcc-uClibc.c @@ -48,6 +48,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/stat.h> #include "gcc-uClibc.h" @@ -84,7 +85,7 @@ static char nostdlib[] = "-nostdlib"; int main(int argc, char **argv) { - int use_build_dir = 0, linking = 1, use_static_linking = 0; + int linking = 1, use_static_linking = 0; int use_stdinc = 1, use_start = 1, use_stdlib = 1; int source_count = 0, use_rpath = 0, verbose = 0; int i, j; @@ -96,10 +97,6 @@ int main(int argc, char **argv) ep = ""; } - if ((strstr(argv[0],"build") != 0) || (strstr(ep,"build") != 0)) { - use_build_dir = 1; - } - if ((strstr(argv[0],"rpath") != 0) || (strstr(ep,"rpath") != 0)) { use_rpath = 1; } @@ -181,7 +178,8 @@ int main(int argc, char **argv) } if (use_stdinc) { gcc_argv[i++] = nostdinc; - gcc_argv[i++] = uClibc_inc[use_build_dir]; + gcc_argv[i++] = uClibc_inc[0]; + gcc_argv[i++] = uClibc_inc[1]; gcc_argv[i++] = GCC_INCDIR; } if (linking && source_count) { @@ -192,14 +190,22 @@ int main(int argc, char **argv) use_rpath = 0; /* so -rpath not needed for normal case */ } } - if (use_build_dir || use_rpath) { - gcc_argv[i++] = rpath[use_build_dir]; + if (use_rpath) { + gcc_argv[i++] = rpath[0]; + gcc_argv[i++] = rpath[1]; } } - gcc_argv[i++] = rpath_link[use_build_dir]; /* just to be safe */ - gcc_argv[i++] = lib_path[use_build_dir]; + gcc_argv[i++] = rpath_link[0]; /* just to be safe */ + gcc_argv[i++] = rpath_link[1]; /* just to be safe */ + gcc_argv[i++] = lib_path[0]; + gcc_argv[i++] = lib_path[1]; if (use_start) { - gcc_argv[i++] = crt0_path[use_build_dir]; + struct stat buf; + if (stat(crt0_path[0], &buf) >= 0) { + gcc_argv[i++] = crt0_path[0]; + } else { + gcc_argv[i++] = crt0_path[1]; + } } if (use_stdlib) { gcc_argv[i++] = nostdlib; |