summaryrefslogtreecommitdiff
path: root/extra/gcc-uClibc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-06-24 07:40:05 +0000
committerEric Andersen <andersen@codepoet.org>2003-06-24 07:40:05 +0000
commit8a6747e01f1e6daa71d81a7ccdfdf59c61d54b55 (patch)
treef3f74710c31be8d345ef2acf3501594a82e5dcf6 /extra/gcc-uClibc
parentdba553769ed6437444b635ba8818e5a3cb252e00 (diff)
Rename the very badly named 'UCLIBC_GCC' to 'UCLIBC_ENV' and
implement 'UCLIBC_CC', which does this: $ UCLIBC_CC=gcc-2.95 /usr/i386-linux-uclibc/bin/i386-uclibc-gcc --version 2.95.4 $ UCLIBC_CC=gcc-3.3 /usr/i386-linux-uclibc/bin/i386-uclibc-gcc --version gcc-3.3 (GCC) 3.3 (Debian) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Diffstat (limited to 'extra/gcc-uClibc')
-rw-r--r--extra/gcc-uClibc/gcc-uClibc.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/extra/gcc-uClibc/gcc-uClibc.c b/extra/gcc-uClibc/gcc-uClibc.c
index 7b48ef8dd..ba6776c86 100644
--- a/extra/gcc-uClibc/gcc-uClibc.c
+++ b/extra/gcc-uClibc/gcc-uClibc.c
@@ -24,12 +24,12 @@
* If you want to use the uninstalled header files and libs, either include
* the string "build" in the invocation name such as
* 'ln -s <ARCH>-uclibc-gcc <ARCH>-uclibc-gcc-build'
- * or include it in the environment variable setting of UCLIBC_GCC.
+ * or include it in the environment variable setting of UCLIBC_ENV.
* Note: This automatically enables the "rpath" behavior described below.
*
* The wrapper will now pass the location of the uClibc shared libs used to
* the linker with the "-rpath" option if the invocation name includes the
- * string "rpath" or if the environment variable UCLIBC_GCC include it (as
+ * string "rpath" or if the environment variable UCLIBC_ENV include it (as
* with "build" above). This is primarily intended to be used on devel
* platforms of the same arch as the target. A good place to use this feature
* would be in the uClibc/test directory.
@@ -39,7 +39,7 @@
* May 31, 2001
*
* "rpath" and "build" behavior are now decoupled. You can of course get
- * the old "build" behavior by setting UCLIBC_GCC="rpath-build". Order
+ * the old "build" behavior by setting UCLIBC_ENV="rpath-build". Order
* isn't important here, as only the substrings are searched for.
*
* Added environment variable check for UCLIBC_GCC_DLOPT to let user specify
@@ -187,6 +187,7 @@ int main(int argc, char **argv)
char *builddir;
char *libstr;
char *build_dlstr = 0;
+ char *cc;
char *ep;
char *rpath_link[2];
char *rpath[2];
@@ -208,6 +209,11 @@ int main(int argc, char **argv)
char *gcrt1_path[2];
#endif
+ cc = getenv("UCLIBC_CC");
+ if (!cc) {
+ cc = GCC_BIN;
+ }
+
application_name = basename(argv[0]);
if (application_name[0] == '-')
application_name++;
@@ -221,10 +227,9 @@ int main(int argc, char **argv)
len = strlen(application_name);
if ((strcmp(application_name+len-3, "g++")==0) ||
(strcmp(application_name+len-3, "c++")==0)) {
- char *gcc_bin = GCC_BIN;
- len = strlen(gcc_bin);
- if (strcmp(gcc_bin+len-3, "gcc")==0) {
- GPLUSPLUS_BIN = strdup(gcc_bin);
+ len = strlen(cc);
+ if (strcmp(cc+len-3, "gcc")==0) {
+ GPLUSPLUS_BIN = strdup(cc);
GPLUSPLUS_BIN[len-1]='+';
GPLUSPLUS_BIN[len-2]='+';
}
@@ -246,6 +251,20 @@ int main(int argc, char **argv)
incstr = getenv("UCLIBC_GCC_INC");
libstr = getenv("UCLIBC_GCC_LIB");
+ ep = getenv("UCLIBC_ENV");
+ if (!ep) {
+ ep = "";
+ }
+
+ if (strstr(ep,"build") != 0) {
+ use_build_dir = 1;
+ }
+
+ if (strstr(ep,"rpath") != 0) {
+ use_rpath = 1;
+ }
+
+
xstrcat(&(rpath_link[0]), "-Wl,-rpath-link,", devprefix, "/lib", NULL);
xstrcat(&(rpath_link[1]), "-Wl,-rpath-link,", builddir, "/lib", NULL);
@@ -282,19 +301,6 @@ int main(int argc, char **argv)
}
#endif
- ep = getenv("UCLIBC_GCC");
- if (!ep) {
- ep = "";
- }
-
- if (strstr(ep,"build") != 0) {
- use_build_dir = 1;
- }
-
- if (strstr(ep,"rpath") != 0) {
- use_rpath = 1;
- }
-
m = 0;
libraries = __builtin_alloca(sizeof(char*) * (argc));
libraries[m] = '\0';
@@ -443,7 +449,7 @@ int main(int argc, char **argv)
close(2);
dup2(gcc_pipe[1], 1);
dup2(gcc_pipe[1], 2);
- argv[0] = GCC_BIN;
+ argv[0] = cc;
argv[2] = "-print-libgcc-file-name";
argv[3] = NULL;
execvp(argv[0], argv);
@@ -485,7 +491,7 @@ crash_n_burn:
gcc_argv[i++] = GPLUSPLUS_BIN;
else
#endif
- gcc_argv[i++] = GCC_BIN;
+ gcc_argv[i++] = cc;
for ( j = 1 ; j < argc ; j++ ) {
if (argv[j]=='\0') {
@@ -625,5 +631,5 @@ crash_n_burn:
return execvp(GPLUSPLUS_BIN, gcc_argv);
else
#endif
- return execvp(GCC_BIN, gcc_argv);
+ return execvp(cc, gcc_argv);
}