diff mbox series

c++tools: Fix up c++tools for --with-gcc-major-version-only

Message ID 20201216231014.GO3788@tucnak
State New
Headers show
Series c++tools: Fix up c++tools for --with-gcc-major-version-only | expand

Commit Message

Jakub Jelinek Dec. 16, 2020, 11:10 p.m. UTC
Hi!

Seems c++tools doesn't honor --with-gcc-major-version-only.
Our distro uses that flag and so everything is installed in
/usr/lib/gcc/<target>/11/...
/usr/libexec/gcc/<target>/11/...
except
/usr/libexec/gcc/<target>/11.0.0/g++-mapper-server

The following patch should fix that, ok for trunk if it passes testing?

2020-12-17  Jakub Jelinek  <jakub@redhat.com>

	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Remove variable.
	(gcc_version): New variable.
	(libexecsubdir): Use $(gcc_version) instead of $(version).
	* configure: Regenerated.


	Jakub

Comments

Jakub Jelinek Dec. 17, 2020, 8:08 a.m. UTC | #1
On Thu, Dec 17, 2020 at 12:10:14AM +0100, Jakub Jelinek via Gcc-patches wrote:
> The following patch should fix that, ok for trunk if it passes testing?

Tested successfully with build both without and with
--with-gcc-major-version-only and make install for both.

> 2020-12-17  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* configure.ac: Add GCC_BASE_VER.
> 	* Makefile.in (version): Remove variable.
> 	(gcc_version): New variable.
> 	(libexecsubdir): Use $(gcc_version) instead of $(version).
> 	* configure: Regenerated.

	Jakub
Nathan Sidwell Dec. 17, 2020, 1:19 p.m. UTC | #2
On 12/16/20 6:10 PM, Jakub Jelinek wrote:
> Hi!
> 
> Seems c++tools doesn't honor --with-gcc-major-version-only.
> Our distro uses that flag and so everything is installed in
> /usr/lib/gcc/<target>/11/...
> /usr/libexec/gcc/<target>/11/...
> except
> /usr/libexec/gcc/<target>/11.0.0/g++-mapper-server
> 
> The following patch should fix that, ok for trunk if it passes testing?
> 
> 2020-12-17  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* configure.ac: Add GCC_BASE_VER.
> 	* Makefile.in (version): Remove variable.
> 	(gcc_version): New variable.
> 	(libexecsubdir): Use $(gcc_version) instead of $(version).
> 	* configure: Regenerated.

Of course, didn't know about that option, thanks

nathan
diff mbox series

Patch

--- c++tools/configure.ac.jj	2020-12-16 23:38:34.091923526 +0100
+++ c++tools/configure.ac	2020-12-17 00:02:48.221661922 +0100
@@ -206,6 +206,9 @@  if test $ac_cv_inet_ntop = yes; then
   [Define if inet_ntop provided.])
 fi
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_FILES([Makefile])
 
--- c++tools/Makefile.in.jj	2020-12-16 23:38:34.091923526 +0100
+++ c++tools/Makefile.in	2020-12-17 00:01:54.419263424 +0100
@@ -20,8 +20,8 @@  prefix := @prefix@
 bindir := @bindir@
 libexecdir := @libexecdir@
 target_noncanonical := @target_noncanonical@
-version := $(shell cat $(srcdir)/../gcc/BASE-VER)
-libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(version)
+gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
+libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
 INSTALL_PROGRAM := @INSTALL_PROGRAM@
 INSTALL_STRIP_PROGRAM := $(srcdir)/../install-sh -c -s
 AUTOCONF := @AUTOCONF@
--- c++tools/configure.jj	2020-12-16 23:38:34.091923526 +0100
+++ c++tools/configure	2020-12-17 00:02:53.849599006 +0100
@@ -585,6 +585,7 @@  ac_unique_file="c++tools"
 ac_unique_file="server.cc"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 ac_ct_CC
 CFLAGS
 CC
@@ -658,6 +659,7 @@  ac_user_opts='
 enable_option_checking
 enable_c___tools
 enable_maintainer_mode
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1287,6 +1289,12 @@  Optional Features:
                           enable maintainer mode. Add rules to rebuild
                           configurey bits
 
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
+
 Some influential environment variables:
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
@@ -3557,6 +3565,21 @@  $as_echo "#define HAVE_INET_NTOP 1" >>co
 
 fi
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_headers="$ac_config_headers config.h"
 
 ac_config_files="$ac_config_files Makefile"