From 6b96ee7b33d32129280e1f59f8337801142d6d5f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 24 Jun 2019 22:12:32 +0000 Subject: attempt to extract compiler version from gcc on Macs git-svn-id: svn://tug.org/texlive/trunk@51449 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/ChangeLog | 5 +++++ Build/source/doc/buildinfo.sh | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'Build') diff --git a/Build/source/ChangeLog b/Build/source/ChangeLog index 806699b0a65..692b91cf36c 100644 --- a/Build/source/ChangeLog +++ b/Build/source/ChangeLog @@ -1,3 +1,8 @@ +2019-06-24 Karl Berry + + * doc/buildinfo.sh (compiler_version): new shell function; + ignore useless first "Configured:" line for gcc->cc on Macs. + 2019-06-23 Karl Berry * doc/buildinfo.sh: output the compiler/other names diff --git a/Build/source/doc/buildinfo.sh b/Build/source/doc/buildinfo.sh index 7784ae5061c..fe889022a8a 100755 --- a/Build/source/doc/buildinfo.sh +++ b/Build/source/doc/buildinfo.sh @@ -12,21 +12,30 @@ fi 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}" -- cgit v1.2.3