PATCH: Handle the shared libgcc is a system library

H . J . Lu hjl@lucon.org
Mon Jul 2 08:37:00 GMT 2001


On Mon, Jul 02, 2001 at 11:06:42AM -0300, Alexandre Oliva wrote:
> On Jul  1, 2001, "H . J . Lu" <hjl@lucon.org> wrote:
> 
> > +    if test -e /lib/libgcc_s.so || test -e /usr/lib/libgcc_s.so; then
> 
> test -e is not portable (IIRC, it breaks at least with Tru64's
> /bin/sh).  Please use test -f instead.
> 

Ooops. Missed this one. Another update.


H.J.
----
2001-07-02  H.J. Lu  (hjl@gnu.org)

	* configure.in (slibdir): Set according to if the shared libgcc
	library is a system shared library.
	* configure: Rebuild.

	* gcc.c (compiler_release): New string for the compiler
	release.
	(option_map): Add --release/-dumprelease.
	(display_help): Add -dumprelease.
	(process_command): Initialize compiler_release and handle
	-dumprelease.

--- gcc/configure.in.libgcc	Wed Jun 13 13:36:24 2001
+++ gcc/configure.in	Mon Jul  2 08:25:31 2001
@@ -1945,14 +1945,26 @@ AC_ARG_ENABLE(version-specific-runtime-l
 
 AC_ARG_WITH(slibdir,
 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
-slibdir="$with_slibdir",
+slibdir="$with_slibdir",[
 if test "${enable_version_specific_runtime_libs+set}" = set; then
   slibdir='$(libsubdir)'
 elif test "$host" != "$target"; then
   slibdir='$(build_tooldir)/lib'
 else
+  # We are building a nativa compiler here since "$host" = "$target".
   slibdir='$(libdir)'
-fi)
+  if test "$build" = "$target"; then
+    # For systems where there is the shared libgcc in /lib or /usr/lib,
+    # we assume it is a system library come from the system vendor, we
+    # install our shared libgcc into $(libsubdir). We only check the
+    # system shared libgcc for the native build.
+    # FIXME: Need to check if the system shared libgcc library is
+    #	     really ok.
+    if test -f /lib/libgcc_s.so.1 || test -f /usr/lib/libgcc_s.so.1; then
+      slibdir='$(libsubdir)'
+    fi
+  fi
+fi])
 AC_SUBST(slibdir)
 
 # Nothing to do for FLOAT_H, float_format already handled.
--- gcc/gcc.c.libgcc	Tue Jun 12 14:38:51 2001
+++ gcc/gcc.c	Mon Jul  2 08:18:19 2001
@@ -157,6 +157,10 @@ static int save_temps_flag;
 
 static const char *compiler_version;
 
+/* The compiler release. */
+
+static const char *compiler_release;
+
 /* The target version specified with -V */
 
 static const char *spec_version = DEFAULT_TARGET_VERSION;
@@ -898,6 +902,7 @@ struct option_map option_map[] =
    {"--user-dependencies", "-MM", 0},
    {"--verbose", "-v", 0},
    {"--version", "-dumpversion", 0},
+   {"--release", "-dumprelease", 0},
    {"--warn-", "-W", "*j"},
    {"--write-dependencies", "-MD", 0},
    {"--write-user-dependencies", "-MMD", 0},
@@ -2897,6 +2902,7 @@ display_help ()
     fputs (_("  (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
   fputs (_("  -dumpspecs               Display all of the built in spec strings\n"), stdout);
   fputs (_("  -dumpversion             Display the version of the compiler\n"), stdout);
+  fputs (_("  -dumprelease             Display the release of the compiler\n"), stdout);
   fputs (_("  -dumpmachine             Display the compiler's target processor\n"), stdout);
   fputs (_("  -print-search-dirs       Display the directories in the compiler's search path\n"), stdout);
   fputs (_("  -print-libgcc-file-name  Display the name of the compiler's companion library\n"), stdout);
@@ -3035,6 +3041,27 @@ process_command (argc, argv)
 	}
     }
 
+  /* Figure compiler release from version string.  */
+  compiler_release = temp1 = xstrdup (version_string);
+
+  for (; *temp1; ++temp1)
+    {
+      if (ISSPACE ((unsigned char) *temp1))
+	*temp1 = '-';
+      else if (*temp1 == '(')
+	{
+	  *temp1 = '\0';
+	  break;
+	}
+    }
+  for (--temp1; *temp1; --temp1)
+    {
+      if (*temp1 == '-')
+	*temp1 = '\0';
+      else
+	break;
+    }
+
   /* Set up the default search paths.  If there is no GCC_EXEC_PREFIX,
      see if we can create it from the pathname specified in argv[0].  */
 
@@ -3200,6 +3227,11 @@ process_command (argc, argv)
       else if (! strcmp (argv[i], "-dumpversion"))
 	{
 	  printf ("%s\n", spec_version);
+	  exit (0);
+	}
+      else if (! strcmp (argv[i], "-dumprelease"))
+	{
+	  printf ("%s\n", compiler_release);
 	  exit (0);
 	}
       else if (! strcmp (argv[i], "-dumpmachine"))



More information about the Gcc-patches mailing list