Re: [PATCH] Introduce --with-gcc-major-version-only configure option (take 2)

2017-01-20 Thread Jakub Jelinek
On Fri, Jan 20, 2017 at 12:12:17AM +0100, Matthias Klose wrote:
> On 19.01.2017 13:26, Jakub Jelinek wrote:
> > On Thu, Jan 19, 2017 at 01:13:14PM +0100, Franz Sirl wrote:
> >> Am 2017-01-12 um 21:16 schrieb Jakub Jelinek:
> >>> libmpx/
> >>>   * configure.ac: Add GCC_BASE_VER.
> >>>   * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> >>>   get version from BASE-VER file.
> >>>   * configure: Regenerated.
> >>
> >> Hi,
> >>
> >> it seems libmpx/configure.ac is missing the acx.m4 include, because there 
> >> is
> >> now a bare GCC_BASE_VER in the regenerated libmpx/configure.
> >>
> >> The attached patch seem to fix it, but I'm not good with autoconf.
> > 
> > Oops, sorry, dunno how this got unnoticed in my testing.
> > The include belongs to aclocal.m4 IMHO, I've committed this as obvious:
> 
> I think this is wrong. aclocal.m4 is an auto-generated file. why would be the
> one in libmpx special to patch directly?

While that is what I've done, apparently if I remove aclocal.m4 and run
PATH=~/autoconf-2.64/bin:~/automake-1.11.6/bin:$PATH aclocal -I .. -I ../config
I get exactly the same file.  Not so in liboffloadmic and libcilkrts, there
I've done the same thing, patching aclocal.m4 by hand, and got the order
differently from what aclocal does.

So here is what I've committed to fix this up:

2017-01-20  Jakub Jelinek  

PR other/79046
liboffloadmic/
* aclocal.m4: Regenerated.
* Makefile.in: Regenerated.
libcilkrts/
* aclocal.m4: Regenerated.
* Makefile.in: Regenerated.

--- liboffloadmic/aclocal.m4.jj 2017-01-17 10:28:40.975354196 +0100
+++ liboffloadmic/aclocal.m42017-01-20 09:20:19.425237914 +0100
@@ -988,11 +988,11 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
-m4_include([../config/acx.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
--- liboffloadmic/Makefile.in.jj2017-01-17 10:28:41.611345693 +0100
+++ liboffloadmic/Makefile.in   2017-01-20 09:20:29.308107715 +0100
@@ -89,14 +89,14 @@ DIST_COMMON = ChangeLog $(srcdir)/Makefi
$(srcdir)/liboffloadmic_host.spec.in \
$(srcdir)/liboffloadmic_target.spec.in $(srcdir)/../depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+   $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
-   $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../libtool.m4 \
-   $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
-   $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
-   $(top_srcdir)/configure.ac
+   $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+   $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+   $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
--- libcilkrts/aclocal.m4.jj2017-01-17 10:28:40.741357325 +0100
+++ libcilkrts/aclocal.m4   2017-01-20 09:17:59.115089608 +0100
@@ -988,11 +988,11 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
-m4_include([../config/acx.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
--- libcilkrts/Makefile.in.jj   2017-01-17 10:28:41.315349650 +0100
+++ libcilkrts/Makefile.in  2017-01-20 09:18:40.764539469 +0100
@@ -161,14 +161,14 @@ DIST_COMMON = $(srcdir)/include/internal
 @MAC_LINKER_SCRIPT_TRUE@am__append_2 = 
-Wl,-exported_symbols_list,$(srcdir)/runtime/mac-symbols.txt
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+   $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
-   $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../libtool.m4 \
-   $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
-   $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
-   $(top_srcdir)/configure.ac
+   $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+   $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+   $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal

Re: [PATCH] Introduce --with-gcc-major-version-only configure option (take 2)

2017-01-19 Thread Matthias Klose
On 19.01.2017 13:26, Jakub Jelinek wrote:
> On Thu, Jan 19, 2017 at 01:13:14PM +0100, Franz Sirl wrote:
>> Am 2017-01-12 um 21:16 schrieb Jakub Jelinek:
>>> libmpx/
>>> * configure.ac: Add GCC_BASE_VER.
>>> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
>>> get version from BASE-VER file.
>>> * configure: Regenerated.
>>
>> Hi,
>>
>> it seems libmpx/configure.ac is missing the acx.m4 include, because there is
>> now a bare GCC_BASE_VER in the regenerated libmpx/configure.
>>
>> The attached patch seem to fix it, but I'm not good with autoconf.
> 
> Oops, sorry, dunno how this got unnoticed in my testing.
> The include belongs to aclocal.m4 IMHO, I've committed this as obvious:

I think this is wrong. aclocal.m4 is an auto-generated file. why would be the
one in libmpx special to patch directly?

Matthias



Re: [PATCH] Introduce --with-gcc-major-version-only configure option (take 2)

2017-01-19 Thread Jakub Jelinek
On Thu, Jan 19, 2017 at 01:13:14PM +0100, Franz Sirl wrote:
> Am 2017-01-12 um 21:16 schrieb Jakub Jelinek:
> > libmpx/
> > * configure.ac: Add GCC_BASE_VER.
> > * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> > get version from BASE-VER file.
> > * configure: Regenerated.
> 
> Hi,
> 
> it seems libmpx/configure.ac is missing the acx.m4 include, because there is
> now a bare GCC_BASE_VER in the regenerated libmpx/configure.
> 
> The attached patch seem to fix it, but I'm not good with autoconf.

Oops, sorry, dunno how this got unnoticed in my testing.
The include belongs to aclocal.m4 IMHO, I've committed this as obvious:

2017-01-19  Jakub Jelinek  

PR other/79046
* aclocal.m4: Include ../config/acx.m4.
* configure: Regenerated.
* Makefile.in: Regenerated.
* mpxrt/Makefile.in: Regenerated.
* mpxwrap/Makefile.in: Regenerated.

--- libmpx/aclocal.m4.jj2015-05-13 18:57:48.0 +0200
+++ libmpx/aclocal.m4   2017-01-19 13:17:35.260138792 +0100
@@ -705,6 +705,7 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([../config/acx.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
--- libmpx/configure.jj 2017-01-17 10:28:41.0 +0100
+++ libmpx/configure2017-01-19 13:18:03.142784322 +0100
@@ -603,6 +603,7 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 XCFLAGS
 enable_static
 enable_shared
@@ -731,6 +732,7 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 '
   ac_precious_vars='build_alias
 host_alias
@@ -1377,6 +1379,8 @@ Optional Packages:
   --with-pic  try to use only PIC/non-PIC objects [default=use
   both]
   --with-gnu-ld   assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+  use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC  C compiler command
@@ -11230,7 +11234,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11233 "configure"
+#line 11237 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11336,7 +11340,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11339 "configure"
+#line 11343 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11586,7 +11590,19 @@ else
 fi
 
 # Determine what GCC version number to use in filesystem paths.
-GCC_BASE_VER
+
+  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_files="$ac_config_files Makefile libmpx.spec"
 
--- libmpx/Makefile.in.jj   2017-01-17 10:28:41.0 +0100
+++ libmpx/Makefile.in  2017-01-19 13:18:09.693701040 +0100
@@ -59,7 +59,8 @@ DIST_COMMON = ChangeLog $(srcdir)/Makefi
$(srcdir)/config.h.in $(srcdir)/../mkinstalldirs \
$(srcdir)/libmpx.spec.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/lead-dot.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+   $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
@@ -216,6 +217,7 @@ dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libmpx/mpxrt/Makefile.in.jj (revision 244570)
+++ libmpx/mpxrt/Makefile.in(working copy)
@@ -55,7 +55,8 @@ target_triplet = @target@
 subdir = mpxrt
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/lead-dot.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+   $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
@@ -210,6 +211,7 @@ dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libmpx/mpxwrap/Makefile.in.jj   (revision 244570)
+++ libmpx/mpxwrap/Makefile.in  (working copy)
@@ -55,7 +55,8 @@ target_triplet = @target@
 subdir = mpxwrap
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdi

Re: [PATCH] Introduce --with-gcc-major-version-only configure option (take 2)

2017-01-19 Thread Franz Sirl

Am 2017-01-12 um 21:16 schrieb Jakub Jelinek:

libmpx/
* configure.ac: Add GCC_BASE_VER.
* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
get version from BASE-VER file.
* configure: Regenerated.


Hi,

it seems libmpx/configure.ac is missing the acx.m4 include, because 
there is now a bare GCC_BASE_VER in the regenerated libmpx/configure.


The attached patch seem to fix it, but I'm not good with autoconf.

Franz

Index: libmpx/configure.ac
===
--- libmpx/configure.ac (revision 244613)
+++ libmpx/configure.ac (working copy)
@@ -1,6 +1,8 @@
 # -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
+sinclude(../config/acx.m4)
+
 AC_PREREQ([2.64])
 AC_INIT(package-unused, version-unused, libmpx)
 


Re: [PATCH] Introduce --with-gcc-major-version-only configure option (take 2)

2017-01-13 Thread Richard Biener
On Thu, Jan 12, 2017 at 9:16 PM, Jakub Jelinek  wrote:
> Hi!
>
> On Tue, Jan 10, 2017 at 07:56:36AM +0100, Jakub Jelinek wrote:
>> As I said on IRC, I think -dumpversion of 7 in this configuration is the
>> right thing to do.  In GCC sources, we have 3 uses of -dumpversion,
>> two of them look like:
>> gcc_version := $(shell $(GOC) -dumpversion)
>> ...
>> toolexeclibgodir = 
>> $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias)
>> libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version)
>> (in libgo and gotools), one in config/tcl.m4 is like:
>> if test "`gcc -dumpversion | awk -F. '{print 
>> [$]1}'`" -lt "3" ; then
>> AC_MSG_WARN([64bit mode not supported with 
>> GCC < 3.2 on $system])
>> which works well whether it prints 7 or 7.1.1.
>> With --with-gcc-major-version-only, the spec_version is different from
>> BASEVER, and -dumpversion can print just one of those, when they are not the
>> same.  So, we either break users that expect they can do
>> `$CC -dumpmachine`-gcc-`$CC -dumpversion`, or find out the C++ includes by
>> g++ -dumpversion, etc., or we break users that expect 3 numbers separated
>> by dot or 2 numbers separated by dot with optional another one.
>> In the past, we have not always pointed 3 numbers, releases printed just
>> major.minor, like gcc -dumpversion printed 3.0 (as mentioned in the manual).
>> But the former 3.0 in the previous versioning scheme corresponds to just 7
>> in the new one.  So, users that expect 3 numbers are already broken,
>> and just one number is just adjusting those assumptions to the current
>> versioning scheme.  Yes, we can add a new option, but IMNSHO it should
>> be -dumpbaseversion or -dumpfullversion that will always print
>> major.minor.patchlevel.  From the SUSE bugzilla, it looks like SUSE has
>> been shipping compilers that printed just 5 or 6 for almost 2 years now,
>> so hopefully some changes if needed somewhere have been already upstreamed.
>
> Here is updated version of the patch that introduces the -dumpfullversion
> option and documents better -dumpversion as well as -dumpfullversion.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Looks good to me.  Please leave others some time to comment.

Thanks,
Richard.

> 2017-01-12  Jakub Jelinek  
>
> PR other/79046
> * configure: Regenerated.
> config/
> * acx.m4 (GCC_BASE_VER): New m4 function.
> (ACX_TOOL_DIRS): Require GCC_BASE_VER, for
> --with-gcc-major-version-only use just major number from BASE-VER.
> gcc/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
> version from BASE-VER file.
> (CFLAGS-gcc.o): Add -DBASEVER=$(BASEVER_s).
> (gcc.o): Depend on $(BASEVER).
> * common.opt (dumpfullversion): New option.
> * gcc.c (driver_handle_option): Handle OPT_dumpfullversion.
> * doc/invoke.texi: Document -dumpfullversion.
> * doc/install.texi: Document --with-gcc-major-version-only.
> * configure: Regenerated.
> libatomic/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> get version from BASE-VER file.
> * testsuite/Makefile.in: Regenerated.
> * configure: Regenerated.
> * Makefile.in: Regenerated.
> libgomp/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> get version from BASE-VER file.
> * testsuite/Makefile.in: Regenerated.
> * configure: Regenerated.
> * Makefile.in: Regenerated.
> libgcc/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
> version from BASE-VER file.
> * configure: Regenerated.
> libssp/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> get version from BASE-VER file.
> * configure: Regenerated.
> * Makefile.in: Regenerated.
> liboffloadmic/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> get version from BASE-VER file.
> * aclocal.m4: Include ../config/acx.m4.
> * configure: Regenerated.
> * Makefile.in: Regenerated.
> libquadmath/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> get version from BASE-VER file.
> * configure: Regenerated.
> * Makefile.in: Regenerated.
> libmpx/
> * configure.ac: Add GCC_BASE_VER.
> * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
> get version from BASE-VER file.
> * configure: Regenerated.
> *