diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:31:14 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:31:14 +0000 |
commit | e79984b9faa5ba5a8daae905d666037670a053a6 (patch) | |
tree | 36cfd51b10bd5af8468b922bbbdece962eb5fdfe | |
parent | 68becdbda74b36035bd3902551b7fe86d3ba32c6 (diff) |
Pull XORG-6_8_0 to CYGWIN branchCYGWIN-6_8_2-MERGECYGWIN-6_8_1-MERGECYGWIN-6_8_0-MERGE
-rw-r--r-- | imake.c | 183 | ||||
-rw-r--r-- | imakemdep.h | 18 | ||||
-rw-r--r-- | mkhtmlindex.pl | 10 |
3 files changed, 155 insertions, 56 deletions
@@ -1178,67 +1178,133 @@ get_binary_format(FILE *inFile) #endif #if defined(sun) && defined(__SVR4) +/* Runs Sun compiler command and parses output - this is a bit of a hack + * as it depends on the particular output format of the -V flag, but it's + * worked for many releases. + * + * Input : cmd - command to run (called with -V flag) + * path - path to command to run (use $PATH if NULL) + * Output: cmajor & cminor - major and minor versions if found + * Returns: 0 if successful, -1 if not. + */ +static int +ask_sun_compiler_for_versions(const char *cmd, const char *path, + int *cmajor, int *cminor) +{ + char buf[BUFSIZ]; + char cmdtorun[PATH_MAX]; + char* vptr; + FILE* ccproc; + const char vflag[] = " -V 2>&1"; + int retval = -1; + + int len = strlen(cmd) + sizeof(vflag); + + if (path != NULL) { + len += strlen(path) + 1; + } + + if (len < sizeof(cmdtorun)) { + if (path != NULL) { + sprintf(cmdtorun, "%s/%s %s", path, cmd, vflag); + } else { + sprintf(cmdtorun, "%s %s", cmd, vflag); + } + + if ((ccproc = popen (cmdtorun, "r")) != NULL) { + if (fgets (buf, sizeof(buf), ccproc) != NULL) { + vptr = strrchr (buf, 'C'); + if (vptr) { + for (; (*vptr != '\0') && !isdigit(*vptr); vptr++) { + /* Do nothing - just scanning for first digit */ + } + if (*vptr != '\0') { + if (sscanf (vptr, "%d.%d", cmajor, cminor) == 2) { + retval = 0; + } + } + } + if (retval != 0) { + fprintf(stderr, + "warning: could not parse version number in output of:\n" + " %s\n", cmdtorun); + } + while (fgets (buf, sizeof(buf), ccproc) != NULL) {}; + } + pclose (ccproc); + } + } + return retval; +} + +/* Find Sun compilers and their versions if present */ static void get_sun_compiler_versions (FILE *inFile) { - char buf[PATH_MAX]; - char cmd[PATH_MAX]; - static char* sunpro_cc = "/opt/SUNWspro/bin/cc"; - static char* sunpro_CC = "/opt/SUNWspro/bin/CC"; - int cmajor, cminor; - char* vptr; + const char* sunpro_path = "/opt/SUNWspro/bin"; + int cmajor, cminor, found = 0; struct stat sb; - FILE* ccproc; + + /* If cross-compiling, only check CrossCompilerDir for compilers. + * If not cross-compiling, first check cc in users $PATH, + * then try /opt/SUNWspro if not found in the users $PATH + */ #if defined CROSSCOMPILE if (CrossCompiling) { - int len = strlen(CrossCompileDir); - len += 3; - sunpro_cc = (char *) malloc(len); - sunpro_CC = (char *) malloc(len); - strcpy(sunpro_cc,CrossCompileDir); - strcpy(sunpro_CC,CrossCompileDir); - strcat(sunpro_cc,"/cc"); - strcat(sunpro_CC,"/CC"); - } -#endif - if (lstat (sunpro_cc, &sb) == 0) { - strcpy (cmd, sunpro_cc); - strcat (cmd, " -V 2>&1"); - if ((ccproc = popen (cmd, "r")) != NULL) { - if (fgets (buf, PATH_MAX, ccproc) != NULL) { - vptr = strrchr (buf, 'C'); - for (; !isdigit(*vptr); vptr++); - (void) sscanf (vptr, "%d.%d", &cmajor, &cminor); - fprintf (inFile, - "#define DefaultSunProCCompilerMajorVersion %d\n", - cmajor); - fprintf (inFile, - "#define DefaultSunProCCompilerMinorVersion %d\n", - cminor); + if (ask_sun_compiler_for_versions("cc", CrossCompileDir, + &cmajor, &cminor) == 0) { + found = 1; } - while (fgets (buf, PATH_MAX, ccproc) != NULL) {}; - pclose (ccproc); - } + } + else +#endif + { + if (ask_sun_compiler_for_versions("cc", NULL, &cmajor, &cminor) == 0) { + found = 1; + } else if (ask_sun_compiler_for_versions("cc", sunpro_path, + &cmajor, &cminor) == 0) { + found = 1; + fprintf(inFile, "#define DefaultSunProCCompilerDir %s", sunpro_path); + } + } + + if (found) { + fprintf (inFile, + "#define DefaultSunProCCompilerMajorVersion %d\n", cmajor); + fprintf (inFile, + "#define DefaultSunProCCompilerMinorVersion %d\n", cminor); } - if (lstat (sunpro_CC, &sb) == 0) { - strcpy (cmd, sunpro_CC); - strcat (cmd, " -V 2>&1"); - if ((ccproc = popen (cmd, "r")) != NULL) { - if (fgets (buf, PATH_MAX, ccproc) != NULL) { - vptr = strrchr (buf, 'C'); - for (; !isdigit(*vptr); vptr++); - (void) sscanf (vptr, "%d.%d", &cmajor, &cminor); - fprintf (inFile, - "#define DefaultSunProCplusplusCompilerMajorVersion %d\n", - cmajor); - fprintf (inFile, - "#define DefaultSunProCplusplusCompilerMinorVersion %d\n", - cminor); + + /* Now do it again for C++ compiler (CC) */ + found = 0; +#if defined CROSSCOMPILE + if (CrossCompiling) { + if (ask_sun_compiler_for_versions("CC", CrossCompileDir, + &cmajor, &cminor) == 0) { + found = 1; } - while (fgets (buf, PATH_MAX, ccproc) != NULL) {}; - pclose (ccproc); - } + } + else +#endif + { + if (ask_sun_compiler_for_versions("CC", NULL, &cmajor, &cminor) == 0) { + found = 1; + } else if (ask_sun_compiler_for_versions("CC", sunpro_path, + &cmajor, &cminor) == 0) { + found = 1; + fprintf(inFile, + "#define DefaultSunProCplusplusCompilerDir %s", sunpro_path); + } + } + + if (found) { + fprintf (inFile, + "#define DefaultSunProCplusplusCompilerMajorVersion %d\n", + cmajor); + fprintf (inFile, + "#define DefaultSunProCplusplusCompilerMinorVersion %d\n", + cminor); } } #endif @@ -1384,6 +1450,21 @@ define_os_defaults(FILE *inFile) name = &uts_name; } #endif +# ifdef __FreeBSD__ + /* Override for compiling in chroot of other OS version, such as + * in the bento build cluster. + */ + { + char *e; + if ((e = getenv("OSREL")) != NULL && + strlen(name->sysname) + strlen(e) + 1 < SYS_NMLN) { + strcpy(name->release, e); + strcpy(name->version, name->sysname); + strcat(name->version, " "); + strcat(name->version, e); + } + } +# endif # if defined DEFAULT_OS_NAME # if defined CROSSCOMPILE diff --git a/imakemdep.h b/imakemdep.h index 38a6d95..dd83943 100644 --- a/imakemdep.h +++ b/imakemdep.h @@ -618,6 +618,9 @@ char *cpp_argv[ARGUMENTS] = { # ifdef ppc "-Dppc", # endif +# ifdef ppc64 + "-Dppc64", +# endif # if defined(m68k) || defined(M68k) || defined(m68040) "-Dm68k", "-DM68k", @@ -679,6 +682,9 @@ char *cpp_argv[ARGUMENTS] = { # ifdef __powerpc__ "-D__powerpc__", # endif +# ifdef __powerpc64__ + "-D__powerpc64__", +# endif # ifdef PowerMAX_OS "-DPowerMAX_OS", # endif @@ -711,6 +717,9 @@ char *cpp_argv[ARGUMENTS] = { # ifdef __ppc__ "-D__ppc__", # endif +# ifdef __ppc64__ + "-D__ppc64__", +# endif # ifdef __i386__ "-D__i386__", # endif @@ -1255,6 +1264,9 @@ struct symtab predefs[] = { # ifdef __powerpc__ {"__powerpc__", "1"}, # endif +# ifdef __powerpc64__ + {"__powerpc64__", "1"}, +# endif # ifdef PowerMAX_OS {"PowerMAX_OS", "1"}, # endif @@ -1332,12 +1344,18 @@ struct symtab predefs[] = { #if defined(__ppc__) {"__ppc__", "1"}, #endif +#if defined(__ppc64__) + {"__ppc64__", "1"}, +#endif #if defined(__BIG_ENDIAN__) {"__BIG_ENDIAN__", "1"}, #endif #if defined(__LITTLE_ENDIAN__) {"__LITTLE_ENDIAN__", "1"}, #endif +#if defined (__CHAR_BIT__) + {"__CHAR_BIT__", DEF_STRINGIFY(__CHAR_BIT__)}, +#endif /* add any additional symbols before this line */ {NULL, NULL} }; diff --git a/mkhtmlindex.pl b/mkhtmlindex.pl index f5a41e3..e0c6b78 100644 --- a/mkhtmlindex.pl +++ b/mkhtmlindex.pl @@ -57,15 +57,15 @@ EOF open(file, "<$dir/$file") || die "Can't open $dir/$file"; while (<file>) { chop; - if (/^<H2>/) { - if (! /<\/H2>$/) { - while (<file> && ! /<\/H2>$/) { + if (/^<[hH]2>/) { + if (! /<\/[hH]2>$/) { + while (<file> && ! /<\/[hH]2>$/) { ; } } $heading = ""; while (<file>) { - if (/^<H2>/) { + if (/^<[hH]2>/) { last; } $heading = "$heading" . "$_"; @@ -76,7 +76,7 @@ EOF ($name, $descr) = split(/-/, $heading, 2); $file =~ /(.*)\.$vol\.html/; $fname = $1; - $descr =~ s/<[P]>//g; + $descr =~ s/<[pP]>//g; print mindex "<LI><A href=\"$file\">$fname</A> - $descr</LI>"; } |