texlive[51449] Build/source: attempt to extract compiler version from

commits+karl at tug.org commits+karl at tug.org
Tue Jun 25 00:12:33 CEST 2019


Revision: 51449
          http://tug.org/svn/texlive?view=revision&revision=51449
Author:   karl
Date:     2019-06-25 00:12:32 +0200 (Tue, 25 Jun 2019)
Log Message:
-----------
attempt to extract compiler version from gcc on Macs

Modified Paths:
--------------
    trunk/Build/source/ChangeLog
    trunk/Build/source/doc/buildinfo.sh

Modified: trunk/Build/source/ChangeLog
===================================================================
--- trunk/Build/source/ChangeLog	2019-06-24 21:07:51 UTC (rev 51448)
+++ trunk/Build/source/ChangeLog	2019-06-24 22:12:32 UTC (rev 51449)
@@ -1,3 +1,8 @@
+2019-06-24  Karl Berry  <karl at freefriends.org>
+
+	* doc/buildinfo.sh (compiler_version): new shell function;
+	 ignore useless first "Configured:" line for gcc->cc on Macs.
+
 2019-06-23  Karl Berry  <karl at freefriends.org>
 
 	* doc/buildinfo.sh: output the compiler/other names

Modified: trunk/Build/source/doc/buildinfo.sh
===================================================================
--- trunk/Build/source/doc/buildinfo.sh	2019-06-24 21:07:51 UTC (rev 51448)
+++ trunk/Build/source/doc/buildinfo.sh	2019-06-24 22:12:32 UTC (rev 51449)
@@ -12,21 +12,30 @@
 
 printf 'UNAME\t"%s"\n'    "`uname -a`"
 
-# /etc/issue often contains only placeholders, so don't bother.
+# /etc/issue often contains only placeholders, so don't bother with it.
 
+# Return version identification for $1, by calling it with --version.
+# gcc on Macs, when linked to cc, has a useless "Configured with:" as
+# the first line. Likely we'll need to generalize for other compilers.
+# We intentionally don't quote $1 in case CC was set to something like
+# "cc --someopt".
+compiler_version () {
+  $1 --version 2>&1 | grep -v '^Configured' | sed 1q
+}
+
 printf 'MAKE\t"%s"\n'     "${MAKE-make}"
 printf 'MAKE-v\t"%s"\n'   "`${MAKE-make} -v 2>&1 | sed 1q`"
 # BSD make does not give version info with -v, but the
 # first line of the usage message is sort of an identifier.
 
-# our configure defaults to using gcc and g++.
+# our configure defaults to using gcc and g++, so we will too.
 printf 'CC\t"%s"\n'       "${CC-gcc}"
 printf 'CFLAGS\t"%s"\n'   "${CFLAGS}"
-printf 'CC-v\t"%s"\n'     "`${CC-gcc} --version 2>&1 | sed 1q`"
-#
+printf 'CC-v\t"%s"\n'     "`compiler_version ${CC-gcc}`"
+# 
 printf 'CXX\t"%s"\n'      "${CXX-g++}"
 printf 'CXXFLAGS\t"%s"\n' "${CXXFLAGS}"
-printf 'CXX-v\t"%s"\n'    "`${CXX-g++} --version 2>&1 | sed 1q`"
+printf 'CXX-v\t"%s"\n'    "`compiler_version ${CXX-g++}`"
 #
 printf 'OBJCXX\t"%s"\n'      "${OBJCXX-cc}"
 printf 'OBJCXXFLAGS\t"%s"\n' "${OBJCXXFLAGS}"



More information about the tex-live-commits mailing list