aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2006-02-16 20:32:41 +0000
committerJoseph Myers <joseph@codesourcery.com>2006-02-16 20:32:41 +0000
commit1f8f6253e5e966d0ef58a921377e11edc3431e2f (patch)
treef5646ab84669640dfe4008b2bb0cc46ba2c4beec
parent7781037e14706031d5ec292587c40240dedc21cf (diff)
* gcc/gcc.c (license_me_flag): New variable.
(no_license): New variable. (process_command): Handle -flicense-me. Initialize no_licence. (main): Check licenses. * gcc/config.gcc: Define TARGET_FLEXLM for *-wrs-linux* targets. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/csl-3_4_3-linux-branch@111149 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog.csl8
-rw-r--r--gcc/config.gcc5
-rw-r--r--gcc/gcc.c95
3 files changed, 106 insertions, 2 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 92ea8e6f5e6..2d1592dbbde 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,11 @@
+2006-02-16 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc/gcc.c (license_me_flag): New variable.
+ (no_license): New variable.
+ (process_command): Handle -flicense-me. Initialize no_licence.
+ (main): Check licenses.
+ * gcc/config.gcc: Define TARGET_FLEXLM for *-wrs-linux* targets.
+
2006-01-31 Joseph Myers <joseph@codesourcery.com>
Backport:
diff --git a/gcc/config.gcc b/gcc/config.gcc
index b1beab40263..cdc1b6781ad 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -689,6 +689,7 @@ arm*-*-linux*) # ARM GNU/Linux with ELF
arm-wrs-linux-gnueabi)
tm_file="$tm_file arm/wrs-linux.h"
tmake_file="$tmake_file arm/t-wrs-linux"
+ tm_defines="$tm_defines TARGET_FLEXLM"
;;
*) ;;
esac
@@ -1050,7 +1051,7 @@ i[34567]86-*-linux*) # Intel 80386's running GNU/Linux
case ${target} in
*-wrs-linux*)
tm_file="${tm_file} i386/x86-64.h"
- tm_defines="${tm_defines} TARGET_BI_ARCH=1"
+ tm_defines="${tm_defines} TARGET_BI_ARCH=1 TARGET_FLEXLM"
need_64bit_hwint=yes
;;
esac
@@ -1621,6 +1622,7 @@ mips*-*-linux*) # Linux MIPS, either endian.
mips-wrs-linux-gnu)
tmake_file="$tmake_file mips/t-wrs-linux"
tm_file="$tm_file mips/wrs-linux.h"
+ tm_defines="$tm_defines TARGET_FLEXLM"
;;
esac
;;
@@ -1761,6 +1763,7 @@ powerpc64-*-linux*|powerpc-wrs-linux-gnu)
# This configuration does not use t-linux64, as there
# are no 64-bit multilibs.
tm_file="$tm_file rs6000/wrs-linux.h"
+ tm_defines="$tm_defines TARGET_FLEXLM"
;;
*)
tmake_file="$tmake_file rs6000/t-linux64"
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 63a2418f2d1..3e842422d5e 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -223,6 +223,11 @@ static int save_temps_flag;
static int use_pipes;
+/* WRS LOCAL
+ Nonzero means to pay attention to the result of the license manager. */
+
+static int license_me_flag;
+
/* The compiler version. */
static const char *compiler_version;
@@ -2933,6 +2938,11 @@ static int warn_B;
/* Gives value to pass as "warn" to add_prefix for standard prefixes. */
static int *warn_std_ptr = 0;
+
+/* WRS LOCAL true if get_feature should _not_ be invoked. */
+#ifdef TARGET_FLEXLM
+static bool no_license;
+#endif
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
@@ -3557,6 +3567,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
verbose_only_flag++;
verbose_flag++;
}
+ else if (strcmp (argv[i], "-flicense-me") == 0)
+ license_me_flag = 1; /* WRS LOCAL */
else if (argv[i][0] == '-' && argv[i][1] != 0)
{
const char *p = &argv[i][1];
@@ -3691,6 +3703,21 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
#endif
goto normal_switch;
+ /* WRS LOCAL only invoke get_feature if we are running
+ the compiler proper. */
+#ifdef TARGET_FLEXLM
+ case 'E':
+ if (argv[i][2] == '\0')
+ no_license = 1;
+ goto normal_switch;
+
+ case 'M':
+ if (argv[i][2] == '\0'
+ || (argv[i][2] == 'M' && argv[i][3] == '\0'))
+ no_license = 1;
+ goto normal_switch;
+#endif
+
default:
normal_switch:
@@ -3896,6 +3923,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
;
else if (! strcmp (argv[i], "-fhelp"))
;
+ else if (! strcmp (argv[i], "-flicense-me"))
+ ;
else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
{
target_system_root = argv[i] + strlen ("--sysroot=");
@@ -5968,6 +5997,9 @@ main (int argc, const char **argv)
char *specs_file;
const char *p;
struct user_specs *uptr;
+#ifdef TARGET_FLEXLM
+ int pid = 0;
+#endif /* defined(TARGET_FLEXLM) */
p = argv[0] + strlen (argv[0]);
while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
@@ -6422,10 +6454,71 @@ main (int argc, const char **argv)
}
else
{
- value = do_spec (input_file_compiler->spec);
+ value = 0;
+
+#ifdef TARGET_FLEXLM
+ if (!no_license)
+ {
+ /* WRS SPR 85973, log the use of the compiler. We do
+ this by fork/execing a program that talks to the
+ license manager daemon. The license client library
+ must remain separate from the GPL, and this method
+ of doing so is explicitly blessed by the FSF's GPL
+ FAQ. */
+ const char *argv[9];
+ char *ptr;
+ char *err_fmt, *err_arg;
+
+ argv[0] = "get_feature";
+ argv[1] = "-co";
+ argv[2] = xstrdup (DEFAULT_TARGET_MACHINE);
+ argv[3] = "-v";
+ argv[4] = "3.3";
+ argv[5] = "gnu";
+ argv[6] = infiles[i].language;
+ argv[7] = (license_me_flag ? "-flicense-me" : "");
+ argv[8] = 0;
+
+ ptr = find_a_file (&exec_prefixes, argv[0], X_OK, 0);
+
+ pid = pexecute (ptr ? ptr : argv[0], (char **)argv,
+ programname, temp_filename,
+ &err_fmt, &err_arg,
+ PEXECUTE_FIRST | PEXECUTE_LAST
+ | (ptr ? 0 : PEXECUTE_SEARCH)
+ | (verbose_flag ? PEXECUTE_VERBOSE : 0));
+ if (pid < 0)
+ value = -1;
+
+ if (ptr)
+ free (ptr);
+ }
+#endif /* defined(TARGET_FLEXLM) */
+
+ /* Now do the compile. */
+ if (!value)
+ value = do_spec (input_file_compiler->spec);
if (value < 0)
this_file_error = 1;
}
+
+#ifdef TARGET_FLEXLM
+ /* The license manager should have finished its work by now.
+ WRS SPR 99246 If the license option is in use, and the manager
+ has returned an error, delete the output files. */
+ if (!no_license && pid > 0)
+ {
+ int status;
+ pwait (pid, &status, 0);
+ if (license_me_flag
+ && (!WIFEXITED (status) || WEXITSTATUS (status)))
+ {
+ this_file_error = 1;
+ error ("no license is available at this time, "
+ "or your license server is not accessible");
+ }
+ }
+#endif /* defined(TARGET_FLEXLM) */
}
/* If this file's name does not contain a recognized suffix,