patch to move $CCNUMVER from dmake to configure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

patch to move $CCNUMVER from dmake to configure

Don Lewis-2
The patch below moves the calculation of $CCNUMVER and some other
variables from main/solenv/inc/tg_compv.mk, where it is only usable by
dmake, to configure, where it can be used by both dmake and gbuild. This
is a requirement for me upstream some compiler bug workaround patches
from the FreeBSD port.

A bit of logic from set_soenv is also moved into configure.  A bunch
more should probably be moved so that the configuration logic is not
spread across so many different places, but that can wait.  Something
else to consider is that it would be nice to use a different value of
$COM for Apple's clang, maybe "ACLANG" or "APPLECLANG" since it  has a
different version numbering scheme that the open-source version of clang
and having a unique identifier would simplify version checking when
applying compiler bug workarounds.

I've tested this patch on Windows, CentOS 6, and FreeBSD.  It really
needs some testing on Mac and OS/2.

If you have an existing, populated build tree, then the most important
tests can be done without even doing a build.  Start off by copying the
*env.set.sh script and solver/420/*/inc/comp_ver.mk to a safe location.
Next apply the patch below, run autoconf, and then run configure.
Compare the values of $COMNAME, $COMID, $CCNUMVER, and $CCVER from the
new *.env.set.sh with the values of those variables from the saved copy
of comp_ver.mk.  Also compare the values of $COM in the new and saved
versions of *.env.set.sh.

Note: I think the old value of $CCNUMVER on the Mac is wrong.  It should
look something like 000800010000 or 000700030000, depending on the
installed version.

Note that I changed -DCPPU_ENV on the Mac from $(COMID) to $(COMNAME)
for consistency with the dmake side.  It shouldn't make a difference in
practice since both have the same value on the Mac.

If things look good, then please try a build with this patch.

Index: main/configure.ac
===================================================================
--- main/configure.ac (revision 1820504)
+++ main/configure.ac (working copy)
@@ -1697,29 +1697,6 @@
    AC_PROG_CC
 fi
 
-dnl Clang detection on supported platforms
-if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
-    if $CC --version 2>&1 | $GREP clang > /dev/null ; then
-        COM_IS=CLANG
-    else
-        COM_IS=GCC
-    fi
-    AC_SUBST(COM_IS)
-fi
-
-if test "$_os" = "FreeBSD"; then
-    FBSD_GCC_RPATH=
-    if "$COM_IS" = "GCC"; then
-        rpath=`$CC --print-file-name libstdc++.so`
-        rpath=`realpath $rpath`
-        rpath=`dirname $rpath`
- if test "$rpath" != "/usr/lib" ; then
-            FBSD_GCC_RPATH="-Wl,-rpath=$rpath"
- fi
-    fi
-    AC_SUBST(FBSD_GCC_RPATH)
-fi
-
 COMPATH=`dirname "$CC"`
 if test "$COMPATH" = "." ; then
     AC_PATH_PROGS(COMPATH, $CC)
@@ -2169,6 +2146,101 @@
 AC_SUBST(MSPDB_PATH)
 AC_SUBST(USE_MINGW)
 
+dnl Compiler detection, logic from setsoenv.in
+case "$build_os" in
+ *cygwin*)
+ if test "$WITH_MINGWIN" = "yes"; then
+ COM="GCC";
+ else
+ COM="MSC";
+ fi;;
+ os2*)
+ COM="GCC";;
+ netbsd | kfreebsd* | freebsd* | linux* | darwin* )
+ if $CC --version 2>&1 | $GREP clang > /dev/null ; then
+ COM="CLANG";
+ else
+ COM="GCC";
+ fi;;
+ solaris*)
+ case "$CC" in
+ *gcc*) COM="GCC";;
+ *) COM="C52";;
+ esac;;
+ osf | aix*)
+ COM="CXX";;
+ *) AC_MSG_ERROR([Unable to decipher compiler for $build_os]);;
+esac
+AC_SUBST(COM)
+
+dnl  Decode the compiler version.  Logic from main/solenv/inc/tg_compv.mk.
+case $COM in
+ GCC)
+ CCVER=`${CC} -dumpversion 2>&1`;
+ CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
+ if test "${CCNUMVER}" -ge 000300000001; then
+ COMID="gcc3";
+ COMNAME="gcc3";
+ elif test "${CCNUMVER}" -ge 000300000001; then
+ COMID="GCC";
+ COMNAME="gcc2";
+ else
+ AC_MSG_ERROR([gcc too old]);
+ fi
+ ;;
+ CLANG)
+ CCVER=`${CC} --version 2>&1 | head -n1 | sed -e"s/.*version //" -e"s/ .*//"`;
+ CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
+ # The version in tg_compv.mk for darwin does not look correct
+ # CCNUMVER = `echo ${CCVER} | sed -e"s/\.//";
+ if test "$build_os" == "darwin"; then
+ COMID="s5abi";
+ COMNAME="s5abi";
+ else
+ COMID="gcc3";
+ COMNAME="gcc3";
+ fi;;
+ MSC)
+ CCVER=`${CC} 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
+ CCNUMVER=`${CC} 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
+ if test "${CCNUMVER}" -ge 001200000000; then
+ COMID="MSC";
+ COMNAME="msci";
+ else
+ AC_MSG_ERROR([MSC compiler too old]);
+ fi
+ ;;
+ C55 | C54 | C52 | C40 | sunpro)
+ CCVER=`${CC} -V 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
+ CCNUMVER=`${CC} -V 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
+ if test "${CCNUMVER}" -ge 00050002; then
+ COMID="C52";
+ COMNAME="sunpro5";
+ else
+ AC_MSG_ERROR([Sun compiler too old]);
+ fi
+ ;;
+ *)
+ AC_MSG_ERROR([Unable to detect compiler version]);;
+esac
+AC_SUBST(CCVER)
+AC_SUBST(CCNUMVER)
+AC_SUBST(COMID)
+AC_SUBST(COMNAME)
+
+if test "$_os" = "FreeBSD"; then
+    FBSD_GCC_RPATH=
+    if "$COM" = "GCC"; then
+        rpath=`$CC --print-file-name libstdc++.so`
+        rpath=`realpath $rpath`
+        rpath=`dirname $rpath`
+ if test "$rpath" != "/usr/lib" ; then
+            FBSD_GCC_RPATH="-Wl,-rpath=$rpath"
+ fi
+    fi
+    AC_SUBST(FBSD_GCC_RPATH)
+fi
+
 dnl ===================================================================
 dnl  .NET needs special treatment
 dnl ===================================================================
Index: main/set_soenv.in
===================================================================
--- main/set_soenv.in (revision 1820536)
+++ main/set_soenv.in (working copy)
@@ -74,7 +74,7 @@
      $BUILD_SOSL_RELEASE, $RSC_ONCE );
 #
 # Platform dependent constant values.
-my ( $BIG_SVX, $COM, $ARCH, $CPU, $CPUNAME, $CVER, $GLIBC, $GUI, $GUIBASE,
+my ( $BIG_SVX, $ARCH, $CPU, $CPUNAME, $CVER, $GLIBC, $GUI, $GUIBASE,
       $GVER, $OS, $OSVERSION, $OUTPATH, $INPATH, $PATH_SEPERATOR,
       $DYNAMIC_CRT, $SET_EXCEPTIONS, $use_shl_versions, $CDPATHx, $JRELIBDIR,
       $JRETOOLKITDIR, $JRETHREADDIR,
@@ -248,10 +248,8 @@
    }
 
    if ( $CC =~ "gcc") {
-       $COM            = "GCC";
        $CVER           = "C300";
    } else {
-       $COM            = "C52";
        $CVER           = "C52";
        $COMEX          = 4;
    }
@@ -306,7 +304,6 @@
       $OUTPATH        = $OUTPATH."2";
    # General NetBSD settings:
       $BIG_SVX        = "TRUE";
-      $COM            = "GCC";
       $COMPATH        = '@COMPATH@';
       $GUI            = "UNX";
       $GUIBASE        = "unx";
@@ -320,7 +317,6 @@
 # General GNU/kFreeBSD settings:
       $CVER           = "C341";
       $BIG_SVX        = "TRUE";
-      $COM            = "GCC";
       $COMPATH        = '@COMPATH@';
       $GLIBC          = "2REDHAT60";
       $GUI            = "UNX";
@@ -358,7 +354,6 @@
 }
 elsif ( $platform =~ m/freebsd/ )
 {     $BIG_SVX        = "TRUE";
-      $COM            = "@COM_IS@";
       $COMPATH        = '@COMPATH@';
       $CVER           = "C300";
       $GUI            = "UNX";
@@ -442,7 +437,6 @@
 # General Linux settings:
       $CVER           = "C341";
       $BIG_SVX        = "TRUE";
-      $COM            = "@COM_IS@";
       $COMPATH        = '@COMPATH@';
       $GLIBC          = "2REDHAT60";
       $GUI            = "UNX";
@@ -661,7 +655,6 @@
 {     print "Setting Tru64 specific values... ";
       $outfile        = "Tru64AlphaEnv.Set";
       $BIG_SVX        = "TRUE";
-      $COM            = "CXX";
       $COMPATH        = '@COMPATH@';
       $CPU            = "A";
       $CPUNAME        = "ALPHA_";
@@ -705,7 +698,6 @@
       $outfile        = "winmingw.set";
       $COMPATH        = PathFormat('@COMPATH@/bin');
       $COMPATH        =~ s/\/bin$//i;
-      $COM            = "GCC";
       $CVER           = "C341";
       $OUTPATH        = "wntgcci";
       $INPATH         = $OUTPATH.$PROEXT;
@@ -717,7 +709,6 @@
       $CXX_X64_BINARY = PathFormat('@COMPATH@/bin/amd64/cl.exe');
       $LINK_X64_BINARY = PathFormat('@COMPATH@/bin/amd64/link.exe');
       $LIBMGR_X64_BINARY = PathFormat('@COMPATH@/bin/amd64/lib.exe');
-      $COM            = "MSC";
       $OUTPATH        = "wntmsci@COMEX@";
       $INPATH         = $OUTPATH.$PROEXT;
       $COMEX          = '@COMEX@';
@@ -759,7 +750,6 @@
   {
       print "Setting OS/2 gcc 3.3.5 specific values... \n";
       $outfile        = "os2env.set";
-      $COM            = "GCC";
       $CVER           = "C300";
       $OUTPATH        = "os2gcci";
       $INPATH         = $OUTPATH.$PROEXT;
@@ -783,7 +773,6 @@
       if( $CC =~ "gcc" )
       {
           print "Setting values for MacOSX/Darwin for Xcode<=3";
-          $COM            = "GCC";
           $outfile        = "MacOSXX86Env.Set";
           $CPU            = "I";
           $CPUNAME        = "INTEL";
@@ -792,7 +781,6 @@
       elsif ($platform =~ m/^i[3456]86/)
       {
           print "Setting values for MacOSX/Darwin on x86_32... ";
-          $COM            = "CLANG";
           $outfile        = "MacOSXX32Env.Set";
           $CPU            = "I";
           $CPUNAME        = "INTEL";
@@ -801,7 +789,6 @@
       elsif ($platform =~ m/^x86_64/)
       {
           print "Setting values for MacOSX/Darwin on x86_64... ";
-          $COM            = "CLANG";
           $outfile        = "MacOSXX64Env.Set";
           $CPU            = "X";
           $CPUNAME        = "X86_64";
@@ -836,7 +823,6 @@
    $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
    $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
    $BIG_SVX        = "TRUE";
-   $COM            = "GCC";
    $CVER           = "C300";
    $COMPATH        = '@COMPATH@';
    $GUI            = "UNX";
@@ -1073,7 +1059,7 @@
    $ILIB             = $cur_dir;
 
    # Mingw is different
-   if ( $COM eq "MSC" )
+   if ( "@COM@" eq "MSC" )
    {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
                         $wps.$JAVA_HOME.$LIB.
                         $wps.$PSDK_HOME.$LIB.
@@ -1094,7 +1080,7 @@
       # ILIB needs to use '\' directory seperators;
       $ILIB = WinPath( $ILIB, ";" );
    }
-   elsif ( $COM eq "GCC" )
+   elsif ( "@COM@" eq "GCC" )
    {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
                         $wps.$SOLARVER.$ds.$INPATH.$BIN.
                         $wps.$JAVA_HOME.$LIB;
@@ -1172,7 +1158,7 @@
    $tmppath =~ s/^\/\//\//;
    $PATH .= $ps.$tmppath;
 
-   if ( $COM eq "MSC" ) {
+   if ( "@COM@" eq "MSC" ) {
        $tmppath = CygFormat($MSPDB_PATH);
    # for .NET to find mspdb71.dll (needed by CL.EXE C/C++ Compiler)
    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
@@ -1443,7 +1429,7 @@
 {  $SOLARINC         .= $I.'$JAVA_HOME'.$ds."include".$ds."win32".
                         $I.'$JAVA_HOME'.$ds."include";
    # Mingw is different
-   if ( $COM eq "MSC" )
+   if ( "@COM@" eq "MSC" )
    {  $SOLARINC       .= $I.'$PSDK_HOME'.$INCLUDE.
                          $I.'$COMPATH'.$ds."include";
       if ( '@ENABLE_DIRECTX@' ne "" ) {
@@ -1455,7 +1441,7 @@
           }
       }
    }
-   elsif ( $COM eq "GCC" )
+   elsif ( "@COM@" eq "GCC" )
    {  $SOLARINC       .= $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".$ds."mingw".$ds."include";
      if ( $USE_MINGW eq "cygwin" )
      {  $SOLARINC    .= $I.PathFormat($USR.$ds."include".$ds."mingw").
@@ -1697,9 +1683,14 @@
 ToFile( "Platform dependent constant values.", $empty, "c" );
 ToFile( "SOLAR_JAVA",        $SOLAR_JAVA,        "e" );
 ToFile( "BIG_SVX",           $BIG_SVX,           "e" );
-ToFile( "COM",               $COM,               "e" );
+ToFile( "COM",               "@COM@",            "e" );
 ToFile( "COMPATH",           $COMPATH,           "e" );
 ToFile( "CC_PATH",           "@CC_PATH@",        "e" );
+ToFile( "COMNAME",           "@COMNAME@",        "e" );
+ToFile( "COMID",             "@COMID@",          "e" );
+ToFile( "CCNUMVER",          "@CCNUMVER@",       "e" );
+ToFile( "CCVER",             "@CCVER@",          "e" );
+
 ToFile( "CXX_X64_BINARY",    $CXX_X64_BINARY,    "e" );
 ToFile( "LINK_X64_BINARY",   $LINK_X64_BINARY,   "e" );
 ToFile( "LIBMGR_X64_BINARY", $LIBMGR_X64_BINARY, "e" );
Index: main/solenv/gbuild/platform/freebsd.mk
===================================================================
--- main/solenv/gbuild/platform/freebsd.mk (revision 1820504)
+++ main/solenv/gbuild/platform/freebsd.mk (working copy)
@@ -59,7 +59,7 @@
 gb_COMPILERDEFS := \
  -D$(COM) \
  -DHAVE_GCC_VISIBILITY_FEATURE \
- -DCPPU_ENV=gcc3 \
+ -DCPPU_ENV=$(COMNAME) \
 
 ifeq ($(CPUNAME),X86_64)
 gb_CPUDEFS := -D$(CPUNAME)
Index: main/solenv/gbuild/platform/linux.mk
===================================================================
--- main/solenv/gbuild/platform/linux.mk (revision 1820504)
+++ main/solenv/gbuild/platform/linux.mk (working copy)
@@ -56,7 +56,7 @@
 gb_COMPILERDEFS := \
  -D$(COM) \
  -DHAVE_GCC_VISIBILITY_FEATURE \
- -DCPPU_ENV=gcc3 \
+ -DCPPU_ENV=$(COMNAME) \
 
 ifeq ($(CPUNAME),X86_64)
 gb_CPUDEFS := -D$(CPUNAME)
Index: main/solenv/gbuild/platform/macosx.mk
===================================================================
--- main/solenv/gbuild/platform/macosx.mk (revision 1820504)
+++ main/solenv/gbuild/platform/macosx.mk (working copy)
@@ -59,7 +59,7 @@
 gb_COMPILERDEFS := \
  -D$(COM) \
  -DHAVE_GCC_VISIBILITY_FEATURE \
- -DCPPU_ENV=$(COMID) \
+ -DCPPU_ENV=$(COMNAME) \
 
 ifeq ($(CPUNAME),POWERPC)
 gb_CPUDEFS := -DPOWERPC -DPPC
Index: main/solenv/gbuild/platform/os2.mk
===================================================================
--- main/solenv/gbuild/platform/os2.mk (revision 1820504)
+++ main/solenv/gbuild/platform/os2.mk (working copy)
@@ -58,7 +58,7 @@
 gb_COMPILERDEFS := \
  -D$(COM) \
  -DHAVE_GCC_VISIBILITY_FEATURE \
- -DCPPU_ENV=gcc3 \
+ -DCPPU_ENV=$(COMNAME) \
 
 gb_CPUDEFS := -DINTEL -D_X86_=1 -DX86
 
Index: main/solenv/gbuild/platform/solaris.mk
===================================================================
--- main/solenv/gbuild/platform/solaris.mk (revision 1820504)
+++ main/solenv/gbuild/platform/solaris.mk (working copy)
@@ -55,7 +55,7 @@
 
 gb_COMPILERDEFS := \
  -D$(COM) \
- -DCPPU_ENV=sunpro5 \
+ -DCPPU_ENV=$(COMNAME) \
 
 gb_CPUDEFS := -D$(CPUNAME)
 ifeq ($(CPUNAME),SPARC)
Index: main/solenv/gbuild/platform/windows.mk
===================================================================
--- main/solenv/gbuild/platform/windows.mk (revision 1820504)
+++ main/solenv/gbuild/platform/windows.mk (working copy)
@@ -59,7 +59,7 @@
  -D_MT \
  -D_DLL \
  -DBOOST_MEM_FN_ENABLE_CDECL \
- -DCPPU_ENV=msci \
+ -DCPPU_ENV=$(COMNAME) \
  -DFULL_DESK \
  -DM1500 \
 
Index: main/solenv/gbuild/platform/winmingw.mk
===================================================================
--- main/solenv/gbuild/platform/winmingw.mk (revision 1820504)
+++ main/solenv/gbuild/platform/winmingw.mk (working copy)
@@ -77,7 +77,7 @@
  -D$(CVER) \
  -DCVER=$(CVER) \
  -DGLIBC=2 \
- -DCPPU_ENV=gcc3 \
+ -DCPPU_ENV=$(COMNAME) \
  -D_MT \
  -D_NATIVE_WCHAR_T_DEFINED \
  -D_MSC_EXTENSIONS \
Index: main/solenv/inc/settings.mk
===================================================================
--- main/solenv/inc/settings.mk (revision 1820504)
+++ main/solenv/inc/settings.mk (working copy)
@@ -878,7 +878,7 @@
 
 UNOIDLINC+=-I. -I.. -I$(PRJ) -I$(PRJ)/inc -I$(PRJ)/$(INPATH)/idl -I$(OUT)/inc -I$(SOLARIDLDIR) -I$(SOLARINCDIR)
 
-CDEFS= -D$(OS) -D$(GUI) -D$(GVER) -D$(COM) -D$(CVER) -D$(CPUNAME)
+CDEFS= -D$(OS) -D$(GUI) -D$(GVER) -D$(COM) -D$(CVER) -D$(CPUNAME) -DCPPU_ENV=$(COMNAME)
 
 .IF "$(USE_STLP_DEBUG)" != "" && "$(GUI)"!="OS2"
 CDEFS+=-D_STLP_DEBUG
@@ -1068,11 +1068,6 @@
 LZIP*=lzip
 CPPLCC*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/cpplcc
 
-.IF "$(DISABLE_ENHANCED_COMID)"==""
-.INCLUDE : tg_compv.mk
-.ELSE          # "$(DISABLE_ENHANCED_COMID)"==""
-COMID=$(COM)
-.ENDIF          # "$(DISABLE_ENHANCED_COMID)"==""
 .IF "$(SOLAR_JAVA)"=="TRUE"
 .IF "$(USE_JAVAVER)"!=""
 .INCLUDE : tg_javav.mk
Index: main/solenv/inc/tg_compv.mk
===================================================================
--- main/solenv/inc/tg_compv.mk (revision 1820504)
+++ main/solenv/inc/tg_compv.mk (nonexistent)
@@ -1,138 +0,0 @@
-#**************************************************************
-#  
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#  
-#    http://www.apache.org/licenses/LICENSE-2.0
-#  
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#  
-#**************************************************************
-
-
-
-COMPVERMK:=$(SOLARINCDIR)/comp_ver.mk
-
-.INCLUDE .IGNORE : $(COMPVERMK)
-
-.IF "$(COMNAME)"=="" || "$(COMPATH:s!\!/!)"!="$(COMPATH_STORED)"
-.IF "$(L10N_framework)"==""
-
-COMNAME:=
-
-.IF "$(COM)"=="GCC"
-CFLAGSVERSION=-dumpversion
-CFLAGSVERSION_CMD=-dumpversion
-CFLAGSNUMVERSION_CMD=-dumpversion $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
-#CFLAGSNUMVERSION_CMD=-dumpversion | 2>&1  $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
-.ELIF "$(COM)"=="CLANG"
-CFLAGSVERSION=--version
-CFLAGSVERSION_CMD=--version | head -n1 | sed -e"s/.*version //" -e"s/ .*//"
-.IF "$(OS)"="FREEBSD"
-CFLAGSNUMVERSION_CMD=${CFLAGSVERSION_CMD} | $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
-.ELSE
-CFLAGSNUMVERSION_CMD=${CFLAGSVERSION_CMD} | sed -e"s/\.//"
-.ENDIF
-.ELIF "$(COM)"=="MSC"
-CFLAGSVERSION=
-CFLAGSVERSION_CMD=  $(PIPEERROR) $(AWK) -f $(SOLARENV)/bin/getcompver.awk
-CFLAGSNUMVERSION_CMD=  $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
-.ENDIF
-
-.IF "$(COM)"=="C55" || "$(COM)"=="C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
-CFLAGSVERSION= -V
-CFLAGSVERSION_CMD= -V  $(PIPEERROR) $(AWK) -f $(SOLARENV)/bin/getcompver.awk
-CFLAGSNUMVERSION_CMD= -V  $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
-.ENDIF
-
-.IF "$(COM)"=="C730"
-CFLAGSVERSION= -version
-CFLAGSVERSION_CMD= -version |& cut -d" " -f4-
-CFLAGSNUMVERSION_CMD= -version |& cut -d" " -f4-
-.ENDIF
-
-# that's the version known by the specific
-# compiler
-CCVER:=$(shell @-$(CXX) $(CFLAGSVERSION_CMD))
-
-# and a computed integer for comparing
-# each point separated token blown up to 4 digits
-CCNUMVER:=$(shell @-$(CXX) $(CFLAGSNUMVERSION_CMD))
-
-.IF "$(COM)"=="MSC"
-.IF "$(CCNUMVER)">="001200000000"
-COMID=MSC
-COMNAME=msci
-.ENDIF
-.ENDIF
-
-.IF "$(COM)"=="GCC"
-
-.IF "$(CCNUMVER)">="000200910000"
-COMID=GCC
-COMNAME=gcc2
-.ENDIF
-
-.IF "$(CCNUMVER)">="000300000001"
-
-COMID=gcc3
-COMNAME=gcc3
-
-.ENDIF
-.ENDIF
-
-.IF "$(COM)"=="C55" || "$(COM)" == "C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
-.IF "$(CCNUMVER)">="00050002"
-COMID=C52
-COMNAME=sunpro5
-.ENDIF
-.ENDIF
-
-.IF "$(COM)"=="C730"
-COMID=C730
-COMNAME=MipsPro
-.ENDIF
-
-.IF "$(COM)"=="CLANG"
-.IF "$(OS)" == "FREEBSD" || "$(OS)" == "LINUX"
-COMID=gcc3
-COMNAME=gcc3
-.ELSE
-COMID=s5abi
-COMNAME=s5abi
-.ENDIF
-.ENDIF
-
-.IF "$(COMNAME)"==""
-
-# "EXCEPTIONSFILES" get compiled before this, but shouldn't
-# appear in the first n modules.
-
-compiler_version_error:
-    @echo ++++++++++++++++++++++++++++++++++++
-    @echo  ERROR!
-    @echo  Could not detect compiler version!
-    @echo  Please extend tg_compv.mk in
-    @echo  "solenv/inc".
-    @echo ++++++++++++++++++++++++++++++++++++
- @echo "$(CXX) $(CFLAGSVERSION)" returns
- @$(CXX) $(CFLAGSVERSION)
-    @echo ++++++++++++++++++++++++++++++++++++
- force_dmake_to_error
-
-.ENDIF          # "$(COMNAME)"==""
-
-CDEFS+=-DCPPU_ENV=$(COMNAME)
-
-.ENDIF # "$(L10N_framework)"==""
-.ENDIF # "$(COMNAME)"==""



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: patch to move $CCNUMVER from dmake to configure

Kay Schenk-2


On 01/11/2018 11:24 PM, Don Lewis wrote:

> The patch below moves the calculation of $CCNUMVER and some other
> variables from main/solenv/inc/tg_compv.mk, where it is only usable by
> dmake, to configure, where it can be used by both dmake and gbuild. This
> is a requirement for me upstream some compiler bug workaround patches
> from the FreeBSD port.
>
> A bit of logic from set_soenv is also moved into configure.  A bunch
> more should probably be moved so that the configuration logic is not
> spread across so many different places, but that can wait.  Something
> else to consider is that it would be nice to use a different value of
> $COM for Apple's clang, maybe "ACLANG" or "APPLECLANG" since it  has a
> different version numbering scheme that the open-source version of clang
> and having a unique identifier would simplify version checking when
> applying compiler bug workarounds.
>
> I've tested this patch on Windows, CentOS 6, and FreeBSD.  It really
> needs some testing on Mac and OS/2.
>
> If you have an existing, populated build tree, then the most important
> tests can be done without even doing a build.  Start off by copying the
> *env.set.sh script and solver/420/*/inc/comp_ver.mk to a safe location.
> Next apply the patch below, run autoconf, and then run configure.
> Compare the values of $COMNAME, $COMID, $CCNUMVER, and $CCVER from the
> new *.env.set.sh with the values of those variables from the saved copy
> of comp_ver.mk.  Also compare the values of $COM in the new and saved
> versions of *.env.set.sh.
>
> Note: I think the old value of $CCNUMVER on the Mac is wrong.  It should
> look something like 000800010000 or 000700030000, depending on the
> installed version.
>
> Note that I changed -DCPPU_ENV on the Mac from $(COMID) to $(COMNAME)
> for consistency with the dmake side.  It shouldn't make a difference in
> practice since both have the same value on the Mac.
>
> If things look good, then please try a build with this patch.

I'm having problems applying these patches. :(
Can you add a new issue and attach all this as a text file.

>
> Index: main/configure.ac
> ===================================================================
> --- main/configure.ac (revision 1820504)
> +++ main/configure.ac (working copy)
> @@ -1697,29 +1697,6 @@
>      AC_PROG_CC
>   fi
>  
> -dnl Clang detection on supported platforms
> -if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
> -    if $CC --version 2>&1 | $GREP clang > /dev/null ; then
> -        COM_IS=CLANG
> -    else
> -        COM_IS=GCC
> -    fi
> -    AC_SUBST(COM_IS)
> -fi
> -
> -if test "$_os" = "FreeBSD"; then
> -    FBSD_GCC_RPATH=
> -    if "$COM_IS" = "GCC"; then
> -        rpath=`$CC --print-file-name libstdc++.so`
> -        rpath=`realpath $rpath`
> -        rpath=`dirname $rpath`
> - if test "$rpath" != "/usr/lib" ; then
> -            FBSD_GCC_RPATH="-Wl,-rpath=$rpath"
> - fi
> -    fi
> -    AC_SUBST(FBSD_GCC_RPATH)
> -fi
> -
>   COMPATH=`dirname "$CC"`
>   if test "$COMPATH" = "." ; then
>       AC_PATH_PROGS(COMPATH, $CC)
> @@ -2169,6 +2146,101 @@
>   AC_SUBST(MSPDB_PATH)
>   AC_SUBST(USE_MINGW)
>  
> +dnl Compiler detection, logic from setsoenv.in
> +case "$build_os" in
> + *cygwin*)
> + if test "$WITH_MINGWIN" = "yes"; then
> + COM="GCC";
> + else
> + COM="MSC";
> + fi;;
> + os2*)
> + COM="GCC";;
> + netbsd | kfreebsd* | freebsd* | linux* | darwin* )
> + if $CC --version 2>&1 | $GREP clang > /dev/null ; then
> + COM="CLANG";
> + else
> + COM="GCC";
> + fi;;
> + solaris*)
> + case "$CC" in
> + *gcc*) COM="GCC";;
> + *) COM="C52";;
> + esac;;
> + osf | aix*)
> + COM="CXX";;
> + *) AC_MSG_ERROR([Unable to decipher compiler for $build_os]);;
> +esac
> +AC_SUBST(COM)
> +
> +dnl  Decode the compiler version.  Logic from main/solenv/inc/tg_compv.mk.
> +case $COM in
> + GCC)
> + CCVER=`${CC} -dumpversion 2>&1`;
> + CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
> + if test "${CCNUMVER}" -ge 000300000001; then
> + COMID="gcc3";
> + COMNAME="gcc3";
> + elif test "${CCNUMVER}" -ge 000300000001; then
> + COMID="GCC";
> + COMNAME="gcc2";
> + else
> + AC_MSG_ERROR([gcc too old]);
> + fi
> + ;;
> + CLANG)
> + CCVER=`${CC} --version 2>&1 | head -n1 | sed -e"s/.*version //" -e"s/ .*//"`;
> + CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
> + # The version in tg_compv.mk for darwin does not look correct
> + # CCNUMVER = `echo ${CCVER} | sed -e"s/\.//";
> + if test "$build_os" == "darwin"; then
> + COMID="s5abi";
> + COMNAME="s5abi";
> + else
> + COMID="gcc3";
> + COMNAME="gcc3";
> + fi;;
> + MSC)
> + CCVER=`${CC} 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
> + CCNUMVER=`${CC} 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
> + if test "${CCNUMVER}" -ge 001200000000; then
> + COMID="MSC";
> + COMNAME="msci";
> + else
> + AC_MSG_ERROR([MSC compiler too old]);
> + fi
> + ;;
> + C55 | C54 | C52 | C40 | sunpro)
> + CCVER=`${CC} -V 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
> + CCNUMVER=`${CC} -V 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
> + if test "${CCNUMVER}" -ge 00050002; then
> + COMID="C52";
> + COMNAME="sunpro5";
> + else
> + AC_MSG_ERROR([Sun compiler too old]);
> + fi
> + ;;
> + *)
> + AC_MSG_ERROR([Unable to detect compiler version]);;
> +esac
> +AC_SUBST(CCVER)
> +AC_SUBST(CCNUMVER)
> +AC_SUBST(COMID)
> +AC_SUBST(COMNAME)
> +
> +if test "$_os" = "FreeBSD"; then
> +    FBSD_GCC_RPATH=
> +    if "$COM" = "GCC"; then
> +        rpath=`$CC --print-file-name libstdc++.so`
> +        rpath=`realpath $rpath`
> +        rpath=`dirname $rpath`
> + if test "$rpath" != "/usr/lib" ; then
> +            FBSD_GCC_RPATH="-Wl,-rpath=$rpath"
> + fi
> +    fi
> +    AC_SUBST(FBSD_GCC_RPATH)
> +fi
> +
>   dnl ===================================================================
>   dnl  .NET needs special treatment
>   dnl ===================================================================
> Index: main/set_soenv.in
> ===================================================================
> --- main/set_soenv.in (revision 1820536)
> +++ main/set_soenv.in (working copy)
> @@ -74,7 +74,7 @@
>        $BUILD_SOSL_RELEASE, $RSC_ONCE );
>   #
>   # Platform dependent constant values.
> -my ( $BIG_SVX, $COM, $ARCH, $CPU, $CPUNAME, $CVER, $GLIBC, $GUI, $GUIBASE,
> +my ( $BIG_SVX, $ARCH, $CPU, $CPUNAME, $CVER, $GLIBC, $GUI, $GUIBASE,
>         $GVER, $OS, $OSVERSION, $OUTPATH, $INPATH, $PATH_SEPERATOR,
>         $DYNAMIC_CRT, $SET_EXCEPTIONS, $use_shl_versions, $CDPATHx, $JRELIBDIR,
>         $JRETOOLKITDIR, $JRETHREADDIR,
> @@ -248,10 +248,8 @@
>      }
>  
>      if ( $CC =~ "gcc") {
> -       $COM            = "GCC";
>          $CVER           = "C300";
>      } else {
> -       $COM            = "C52";
>          $CVER           = "C52";
>          $COMEX          = 4;
>      }
> @@ -306,7 +304,6 @@
>         $OUTPATH        = $OUTPATH."2";
>      # General NetBSD settings:
>         $BIG_SVX        = "TRUE";
> -      $COM            = "GCC";
>         $COMPATH        = '@COMPATH@';
>         $GUI            = "UNX";
>         $GUIBASE        = "unx";
> @@ -320,7 +317,6 @@
>   # General GNU/kFreeBSD settings:
>         $CVER           = "C341";
>         $BIG_SVX        = "TRUE";
> -      $COM            = "GCC";
>         $COMPATH        = '@COMPATH@';
>         $GLIBC          = "2REDHAT60";
>         $GUI            = "UNX";
> @@ -358,7 +354,6 @@
>   }
>   elsif ( $platform =~ m/freebsd/ )
>   {     $BIG_SVX        = "TRUE";
> -      $COM            = "@COM_IS@";
>         $COMPATH        = '@COMPATH@';
>         $CVER           = "C300";
>         $GUI            = "UNX";
> @@ -442,7 +437,6 @@
>   # General Linux settings:
>         $CVER           = "C341";
>         $BIG_SVX        = "TRUE";
> -      $COM            = "@COM_IS@";
>         $COMPATH        = '@COMPATH@';
>         $GLIBC          = "2REDHAT60";
>         $GUI            = "UNX";
> @@ -661,7 +655,6 @@
>   {     print "Setting Tru64 specific values... ";
>         $outfile        = "Tru64AlphaEnv.Set";
>         $BIG_SVX        = "TRUE";
> -      $COM            = "CXX";
>         $COMPATH        = '@COMPATH@';
>         $CPU            = "A";
>         $CPUNAME        = "ALPHA_";
> @@ -705,7 +698,6 @@
>         $outfile        = "winmingw.set";
>         $COMPATH        = PathFormat('@COMPATH@/bin');
>         $COMPATH        =~ s/\/bin$//i;
> -      $COM            = "GCC";
>         $CVER           = "C341";
>         $OUTPATH        = "wntgcci";
>         $INPATH         = $OUTPATH.$PROEXT;
> @@ -717,7 +709,6 @@
>         $CXX_X64_BINARY = PathFormat('@COMPATH@/bin/amd64/cl.exe');
>         $LINK_X64_BINARY = PathFormat('@COMPATH@/bin/amd64/link.exe');
>         $LIBMGR_X64_BINARY = PathFormat('@COMPATH@/bin/amd64/lib.exe');
> -      $COM            = "MSC";
>         $OUTPATH        = "wntmsci@COMEX@";
>         $INPATH         = $OUTPATH.$PROEXT;
>         $COMEX          = '@COMEX@';
> @@ -759,7 +750,6 @@
>     {
>         print "Setting OS/2 gcc 3.3.5 specific values... \n";
>         $outfile        = "os2env.set";
> -      $COM            = "GCC";
>         $CVER           = "C300";
>         $OUTPATH        = "os2gcci";
>         $INPATH         = $OUTPATH.$PROEXT;
> @@ -783,7 +773,6 @@
>         if( $CC =~ "gcc" )
>         {
>             print "Setting values for MacOSX/Darwin for Xcode<=3";
> -          $COM            = "GCC";
>             $outfile        = "MacOSXX86Env.Set";
>             $CPU            = "I";
>             $CPUNAME        = "INTEL";
> @@ -792,7 +781,6 @@
>         elsif ($platform =~ m/^i[3456]86/)
>         {
>             print "Setting values for MacOSX/Darwin on x86_32... ";
> -          $COM            = "CLANG";
>             $outfile        = "MacOSXX32Env.Set";
>             $CPU            = "I";
>             $CPUNAME        = "INTEL";
> @@ -801,7 +789,6 @@
>         elsif ($platform =~ m/^x86_64/)
>         {
>             print "Setting values for MacOSX/Darwin on x86_64... ";
> -          $COM            = "CLANG";
>             $outfile        = "MacOSXX64Env.Set";
>             $CPU            = "X";
>             $CPUNAME        = "X86_64";
> @@ -836,7 +823,6 @@
>      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
>      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
>      $BIG_SVX        = "TRUE";
> -   $COM            = "GCC";
>      $CVER           = "C300";
>      $COMPATH        = '@COMPATH@';
>      $GUI            = "UNX";
> @@ -1073,7 +1059,7 @@
>      $ILIB             = $cur_dir;
>  
>      # Mingw is different
> -   if ( $COM eq "MSC" )
> +   if ( "@COM@" eq "MSC" )
>      {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
>                           $wps.$JAVA_HOME.$LIB.
>                           $wps.$PSDK_HOME.$LIB.
> @@ -1094,7 +1080,7 @@
>         # ILIB needs to use '\' directory seperators;
>         $ILIB = WinPath( $ILIB, ";" );
>      }
> -   elsif ( $COM eq "GCC" )
> +   elsif ( "@COM@" eq "GCC" )
>      {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
>                           $wps.$SOLARVER.$ds.$INPATH.$BIN.
>                           $wps.$JAVA_HOME.$LIB;
> @@ -1172,7 +1158,7 @@
>      $tmppath =~ s/^\/\//\//;
>      $PATH .= $ps.$tmppath;
>  
> -   if ( $COM eq "MSC" ) {
> +   if ( "@COM@" eq "MSC" ) {
>          $tmppath = CygFormat($MSPDB_PATH);
>     # for .NET to find mspdb71.dll (needed by CL.EXE C/C++ Compiler)
>     if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
> @@ -1443,7 +1429,7 @@
>   {  $SOLARINC         .= $I.'$JAVA_HOME'.$ds."include".$ds."win32".
>                           $I.'$JAVA_HOME'.$ds."include";
>      # Mingw is different
> -   if ( $COM eq "MSC" )
> +   if ( "@COM@" eq "MSC" )
>      {  $SOLARINC       .= $I.'$PSDK_HOME'.$INCLUDE.
>                            $I.'$COMPATH'.$ds."include";
>         if ( '@ENABLE_DIRECTX@' ne "" ) {
> @@ -1455,7 +1441,7 @@
>             }
>         }
>      }
> -   elsif ( $COM eq "GCC" )
> +   elsif ( "@COM@" eq "GCC" )
>      {  $SOLARINC       .= $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".$ds."mingw".$ds."include";
>        if ( $USE_MINGW eq "cygwin" )
>        {  $SOLARINC    .= $I.PathFormat($USR.$ds."include".$ds."mingw").
> @@ -1697,9 +1683,14 @@
>   ToFile( "Platform dependent constant values.", $empty, "c" );
>   ToFile( "SOLAR_JAVA",        $SOLAR_JAVA,        "e" );
>   ToFile( "BIG_SVX",           $BIG_SVX,           "e" );
> -ToFile( "COM",               $COM,               "e" );
> +ToFile( "COM",               "@COM@",            "e" );
>   ToFile( "COMPATH",           $COMPATH,           "e" );
>   ToFile( "CC_PATH",           "@CC_PATH@",        "e" );
> +ToFile( "COMNAME",           "@COMNAME@",        "e" );
> +ToFile( "COMID",             "@COMID@",          "e" );
> +ToFile( "CCNUMVER",          "@CCNUMVER@",       "e" );
> +ToFile( "CCVER",             "@CCVER@",          "e" );
> +
>   ToFile( "CXX_X64_BINARY",    $CXX_X64_BINARY,    "e" );
>   ToFile( "LINK_X64_BINARY",   $LINK_X64_BINARY,   "e" );
>   ToFile( "LIBMGR_X64_BINARY", $LIBMGR_X64_BINARY, "e" );
> Index: main/solenv/gbuild/platform/freebsd.mk
> ===================================================================
> --- main/solenv/gbuild/platform/freebsd.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/freebsd.mk (working copy)
> @@ -59,7 +59,7 @@
>   gb_COMPILERDEFS := \
>   -D$(COM) \
>   -DHAVE_GCC_VISIBILITY_FEATURE \
> - -DCPPU_ENV=gcc3 \
> + -DCPPU_ENV=$(COMNAME) \
>  
>   ifeq ($(CPUNAME),X86_64)
>   gb_CPUDEFS := -D$(CPUNAME)
> Index: main/solenv/gbuild/platform/linux.mk
> ===================================================================
> --- main/solenv/gbuild/platform/linux.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/linux.mk (working copy)
> @@ -56,7 +56,7 @@
>   gb_COMPILERDEFS := \
>   -D$(COM) \
>   -DHAVE_GCC_VISIBILITY_FEATURE \
> - -DCPPU_ENV=gcc3 \
> + -DCPPU_ENV=$(COMNAME) \
>  
>   ifeq ($(CPUNAME),X86_64)
>   gb_CPUDEFS := -D$(CPUNAME)
> Index: main/solenv/gbuild/platform/macosx.mk
> ===================================================================
> --- main/solenv/gbuild/platform/macosx.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/macosx.mk (working copy)
> @@ -59,7 +59,7 @@
>   gb_COMPILERDEFS := \
>   -D$(COM) \
>   -DHAVE_GCC_VISIBILITY_FEATURE \
> - -DCPPU_ENV=$(COMID) \
> + -DCPPU_ENV=$(COMNAME) \
>  
>   ifeq ($(CPUNAME),POWERPC)
>   gb_CPUDEFS := -DPOWERPC -DPPC
> Index: main/solenv/gbuild/platform/os2.mk
> ===================================================================
> --- main/solenv/gbuild/platform/os2.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/os2.mk (working copy)
> @@ -58,7 +58,7 @@
>   gb_COMPILERDEFS := \
>   -D$(COM) \
>   -DHAVE_GCC_VISIBILITY_FEATURE \
> - -DCPPU_ENV=gcc3 \
> + -DCPPU_ENV=$(COMNAME) \
>  
>   gb_CPUDEFS := -DINTEL -D_X86_=1 -DX86
>  
> Index: main/solenv/gbuild/platform/solaris.mk
> ===================================================================
> --- main/solenv/gbuild/platform/solaris.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/solaris.mk (working copy)
> @@ -55,7 +55,7 @@
>  
>   gb_COMPILERDEFS := \
>   -D$(COM) \
> - -DCPPU_ENV=sunpro5 \
> + -DCPPU_ENV=$(COMNAME) \
>  
>   gb_CPUDEFS := -D$(CPUNAME)
>   ifeq ($(CPUNAME),SPARC)
> Index: main/solenv/gbuild/platform/windows.mk
> ===================================================================
> --- main/solenv/gbuild/platform/windows.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/windows.mk (working copy)
> @@ -59,7 +59,7 @@
>   -D_MT \
>   -D_DLL \
>   -DBOOST_MEM_FN_ENABLE_CDECL \
> - -DCPPU_ENV=msci \
> + -DCPPU_ENV=$(COMNAME) \
>   -DFULL_DESK \
>   -DM1500 \
>  
> Index: main/solenv/gbuild/platform/winmingw.mk
> ===================================================================
> --- main/solenv/gbuild/platform/winmingw.mk (revision 1820504)
> +++ main/solenv/gbuild/platform/winmingw.mk (working copy)
> @@ -77,7 +77,7 @@
>   -D$(CVER) \
>   -DCVER=$(CVER) \
>   -DGLIBC=2 \
> - -DCPPU_ENV=gcc3 \
> + -DCPPU_ENV=$(COMNAME) \
>   -D_MT \
>   -D_NATIVE_WCHAR_T_DEFINED \
>   -D_MSC_EXTENSIONS \
> Index: main/solenv/inc/settings.mk
> ===================================================================
> --- main/solenv/inc/settings.mk (revision 1820504)
> +++ main/solenv/inc/settings.mk (working copy)
> @@ -878,7 +878,7 @@
>  
>   UNOIDLINC+=-I. -I.. -I$(PRJ) -I$(PRJ)/inc -I$(PRJ)/$(INPATH)/idl -I$(OUT)/inc -I$(SOLARIDLDIR) -I$(SOLARINCDIR)
>  
> -CDEFS= -D$(OS) -D$(GUI) -D$(GVER) -D$(COM) -D$(CVER) -D$(CPUNAME)
> +CDEFS= -D$(OS) -D$(GUI) -D$(GVER) -D$(COM) -D$(CVER) -D$(CPUNAME) -DCPPU_ENV=$(COMNAME)
>  
>   .IF "$(USE_STLP_DEBUG)" != "" && "$(GUI)"!="OS2"
>   CDEFS+=-D_STLP_DEBUG
> @@ -1068,11 +1068,6 @@
>   LZIP*=lzip
>   CPPLCC*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/cpplcc
>  
> -.IF "$(DISABLE_ENHANCED_COMID)"==""
> -.INCLUDE : tg_compv.mk
> -.ELSE          # "$(DISABLE_ENHANCED_COMID)"==""
> -COMID=$(COM)
> -.ENDIF          # "$(DISABLE_ENHANCED_COMID)"==""
>   .IF "$(SOLAR_JAVA)"=="TRUE"
>   .IF "$(USE_JAVAVER)"!=""
>   .INCLUDE : tg_javav.mk
> Index: main/solenv/inc/tg_compv.mk
> ===================================================================
> --- main/solenv/inc/tg_compv.mk (revision 1820504)
> +++ main/solenv/inc/tg_compv.mk (nonexistent)
> @@ -1,138 +0,0 @@
> -#**************************************************************
> -#
> -#  Licensed to the Apache Software Foundation (ASF) under one
> -#  or more contributor license agreements.  See the NOTICE file
> -#  distributed with this work for additional information
> -#  regarding copyright ownership.  The ASF licenses this file
> -#  to you under the Apache License, Version 2.0 (the
> -#  "License"); you may not use this file except in compliance
> -#  with the License.  You may obtain a copy of the License at
> -#
> -#    http://www.apache.org/licenses/LICENSE-2.0
> -#
> -#  Unless required by applicable law or agreed to in writing,
> -#  software distributed under the License is distributed on an
> -#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -#  KIND, either express or implied.  See the License for the
> -#  specific language governing permissions and limitations
> -#  under the License.
> -#
> -#**************************************************************
> -
> -
> -
> -COMPVERMK:=$(SOLARINCDIR)/comp_ver.mk
> -
> -.INCLUDE .IGNORE : $(COMPVERMK)
> -
> -.IF "$(COMNAME)"=="" || "$(COMPATH:s!\!/!)"!="$(COMPATH_STORED)"
> -.IF "$(L10N_framework)"==""
> -
> -COMNAME:=
> -
> -.IF "$(COM)"=="GCC"
> -CFLAGSVERSION=-dumpversion
> -CFLAGSVERSION_CMD=-dumpversion
> -CFLAGSNUMVERSION_CMD=-dumpversion $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
> -#CFLAGSNUMVERSION_CMD=-dumpversion | 2>&1  $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
> -.ELIF "$(COM)"=="CLANG"
> -CFLAGSVERSION=--version
> -CFLAGSVERSION_CMD=--version | head -n1 | sed -e"s/.*version //" -e"s/ .*//"
> -.IF "$(OS)"="FREEBSD"
> -CFLAGSNUMVERSION_CMD=${CFLAGSVERSION_CMD} | $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
> -.ELSE
> -CFLAGSNUMVERSION_CMD=${CFLAGSVERSION_CMD} | sed -e"s/\.//"
> -.ENDIF
> -.ELIF "$(COM)"=="MSC"
> -CFLAGSVERSION=
> -CFLAGSVERSION_CMD=  $(PIPEERROR) $(AWK) -f $(SOLARENV)/bin/getcompver.awk
> -CFLAGSNUMVERSION_CMD=  $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
> -.ENDIF
> -
> -.IF "$(COM)"=="C55" || "$(COM)"=="C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
> -CFLAGSVERSION= -V
> -CFLAGSVERSION_CMD= -V  $(PIPEERROR) $(AWK) -f $(SOLARENV)/bin/getcompver.awk
> -CFLAGSNUMVERSION_CMD= -V  $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
> -.ENDIF
> -
> -.IF "$(COM)"=="C730"
> -CFLAGSVERSION= -version
> -CFLAGSVERSION_CMD= -version |& cut -d" " -f4-
> -CFLAGSNUMVERSION_CMD= -version |& cut -d" " -f4-
> -.ENDIF
> -
> -# that's the version known by the specific
> -# compiler
> -CCVER:=$(shell @-$(CXX) $(CFLAGSVERSION_CMD))
> -
> -# and a computed integer for comparing
> -# each point separated token blown up to 4 digits
> -CCNUMVER:=$(shell @-$(CXX) $(CFLAGSNUMVERSION_CMD))
> -
> -.IF "$(COM)"=="MSC"
> -.IF "$(CCNUMVER)">="001200000000"
> -COMID=MSC
> -COMNAME=msci
> -.ENDIF
> -.ENDIF
> -
> -.IF "$(COM)"=="GCC"
> -
> -.IF "$(CCNUMVER)">="000200910000"
> -COMID=GCC
> -COMNAME=gcc2
> -.ENDIF
> -
> -.IF "$(CCNUMVER)">="000300000001"
> -
> -COMID=gcc3
> -COMNAME=gcc3
> -
> -.ENDIF
> -.ENDIF
> -
> -.IF "$(COM)"=="C55" || "$(COM)" == "C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
> -.IF "$(CCNUMVER)">="00050002"
> -COMID=C52
> -COMNAME=sunpro5
> -.ENDIF
> -.ENDIF
> -
> -.IF "$(COM)"=="C730"
> -COMID=C730
> -COMNAME=MipsPro
> -.ENDIF
> -
> -.IF "$(COM)"=="CLANG"
> -.IF "$(OS)" == "FREEBSD" || "$(OS)" == "LINUX"
> -COMID=gcc3
> -COMNAME=gcc3
> -.ELSE
> -COMID=s5abi
> -COMNAME=s5abi
> -.ENDIF
> -.ENDIF
> -
> -.IF "$(COMNAME)"==""
> -
> -# "EXCEPTIONSFILES" get compiled before this, but shouldn't
> -# appear in the first n modules.
> -
> -compiler_version_error:
> -    @echo ++++++++++++++++++++++++++++++++++++
> -    @echo  ERROR!
> -    @echo  Could not detect compiler version!
> -    @echo  Please extend tg_compv.mk in
> -    @echo  "solenv/inc".
> -    @echo ++++++++++++++++++++++++++++++++++++
> - @echo "$(CXX) $(CFLAGSVERSION)" returns
> - @$(CXX) $(CFLAGSVERSION)
> -    @echo ++++++++++++++++++++++++++++++++++++
> - force_dmake_to_error
> -
> -.ENDIF          # "$(COMNAME)"==""
> -
> -CDEFS+=-DCPPU_ENV=$(COMNAME)
> -
> -.ENDIF # "$(L10N_framework)"==""
> -.ENDIF # "$(COMNAME)"==""
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

--
------------------------------------------
MzK

"Ring out the false, ring in the true."
  -- poem "In Memoriam", Alfred Lord Tennyson

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: patch to move $CCNUMVER from dmake to configure

Don Lewis-2
On 16 Jan, Kay Schenk wrote:

>
>
> On 01/11/2018 11:24 PM, Don Lewis wrote:
>> The patch below moves the calculation of $CCNUMVER and some other
>> variables from main/solenv/inc/tg_compv.mk, where it is only usable by
>> dmake, to configure, where it can be used by both dmake and gbuild. This
>> is a requirement for me upstream some compiler bug workaround patches
>> from the FreeBSD port.
>>
>> A bit of logic from set_soenv is also moved into configure.  A bunch
>> more should probably be moved so that the configuration logic is not
>> spread across so many different places, but that can wait.  Something
>> else to consider is that it would be nice to use a different value of
>> $COM for Apple's clang, maybe "ACLANG" or "APPLECLANG" since it  has a
>> different version numbering scheme that the open-source version of clang
>> and having a unique identifier would simplify version checking when
>> applying compiler bug workarounds.
>>
>> I've tested this patch on Windows, CentOS 6, and FreeBSD.  It really
>> needs some testing on Mac and OS/2.
>>
>> If you have an existing, populated build tree, then the most important
>> tests can be done without even doing a build.  Start off by copying the
>> *env.set.sh script and solver/420/*/inc/comp_ver.mk to a safe location.
>> Next apply the patch below, run autoconf, and then run configure.
>> Compare the values of $COMNAME, $COMID, $CCNUMVER, and $CCVER from the
>> new *.env.set.sh with the values of those variables from the saved copy
>> of comp_ver.mk.  Also compare the values of $COM in the new and saved
>> versions of *.env.set.sh.
>>
>> Note: I think the old value of $CCNUMVER on the Mac is wrong.  It should
>> look something like 000800010000 or 000700030000, depending on the
>> installed version.
>>
>> Note that I changed -DCPPU_ENV on the Mac from $(COMID) to $(COMNAME)
>> for consistency with the dmake side.  It shouldn't make a difference in
>> practice since both have the same value on the Mac.
>>
>> If things look good, then please try a build with this patch.
>
> I'm having problems applying these patches. :(
> Can you add a new issue and attach all this as a text file.

https://bz.apache.org/ooo/show_bug.cgi?id=127664

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: patch to move $CCNUMVER from dmake to configure

Kay Schenk-2

On 01/17/2018 11:17 PM, Don Lewis wrote:

> On 16 Jan, Kay Schenk wrote:
>>
>> On 01/11/2018 11:24 PM, Don Lewis wrote:
>>> The patch below moves the calculation of $CCNUMVER and some other
>>> variables from main/solenv/inc/tg_compv.mk, where it is only usable by
>>> dmake, to configure, where it can be used by both dmake and gbuild. This
>>> is a requirement for me upstream some compiler bug workaround patches
>>> from the FreeBSD port.
>>>
>>> A bit of logic from set_soenv is also moved into configure.  A bunch
>>> more should probably be moved so that the configuration logic is not
>>> spread across so many different places, but that can wait.  Something
>>> else to consider is that it would be nice to use a different value of
>>> $COM for Apple's clang, maybe "ACLANG" or "APPLECLANG" since it  has a
>>> different version numbering scheme that the open-source version of clang
>>> and having a unique identifier would simplify version checking when
>>> applying compiler bug workarounds.
>>>
>>> I've tested this patch on Windows, CentOS 6, and FreeBSD.  It really
>>> needs some testing on Mac and OS/2.
>>>
>>> If you have an existing, populated build tree, then the most important
>>> tests can be done without even doing a build.  Start off by copying the
>>> *env.set.sh script and solver/420/*/inc/comp_ver.mk to a safe location.
>>> Next apply the patch below, run autoconf, and then run configure.
>>> Compare the values of $COMNAME, $COMID, $CCNUMVER, and $CCVER from the
>>> new *.env.set.sh with the values of those variables from the saved copy
>>> of comp_ver.mk.  Also compare the values of $COM in the new and saved
>>> versions of *.env.set.sh.
>>>
>>> Note: I think the old value of $CCNUMVER on the Mac is wrong.  It should
>>> look something like 000800010000 or 000700030000, depending on the
>>> installed version.
>>>
>>> Note that I changed -DCPPU_ENV on the Mac from $(COMID) to $(COMNAME)
>>> for consistency with the dmake side.  It shouldn't make a difference in
>>> practice since both have the same value on the Mac.
>>>
>>> If things look good, then please try a build with this patch.
>> I'm having problems applying these patches. :(
>> Can you add a new issue and attach all this as a text file.
> https://bz.apache.org/ooo/show_bug.cgi?id=127664

Thanks. Additional comments in issue.


--
------------------------------------------
MzK

"Ring out the false, ring in the true."
  -- poem "In Memoriam", Alfred Lord Tennyson


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]