You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/04/30 06:08:17 UTC

git commit: TS-1864 Rearrange some of the autoconf code, order matters

Updated Branches:
  refs/heads/master 54b532b64 -> d8c526233


TS-1864 Rearrange some of the autoconf code, order matters


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d8c52623
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d8c52623
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d8c52623

Branch: refs/heads/master
Commit: d8c5262331e0654097640982100f43731e7e8f6d
Parents: 54b532b
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Apr 29 17:00:51 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Apr 29 22:07:27 2013 -0600

----------------------------------------------------------------------
 configure.ac |  178 ++++++++++++++++++++++++++---------------------------
 1 files changed, 87 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d8c52623/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index e45d67c..7f2c313 100644
--- a/configure.ac
+++ b/configure.ac
@@ -529,6 +529,9 @@ _ts_saved_CXXFLAGS="${CXXFLAGS}"
 
 AC_PROG_CC
 AC_PROG_CXX
+AC_PROG_CPP
+AC_PROG_CXXCPP
+AM_PROG_AS
 
 CFLAGS="${_ts_saved_CFLAGS}"
 CXXFLAGS="${_ts_saved_CXXFLAGS}"
@@ -568,14 +571,57 @@ ifdef([AC_PROG_SED], [], [
   ])
 ])
 
+
+# Various OS specific setup. Note that on Solaris, 32-bit is always the
+# default, even on a box that with 64-bit architecture.
+# This also sets up a "normalized" variable and define $host_os_def.
+defer_accept=1
+case $host_os in
+  linux*)
+    host_os_def="linux"
+    defer_accept=45
+    EXTRA_CXX_LDFLAGS="-rdynamic"
+    ;;
+  darwin*)
+    host_os_def="darwin"
+    ;;
+  freebsd*)
+    host_os_def="freebsd"
+    EXTRA_CXX_LDFLAGS="-rdynamic"
+    TS_ADDTO(CPPFLAGS, [-I/usr/local/include])
+    ;;
+  kfreebsd*)
+    host_os_def="freebsd"
+    EXTRA_CXX_LDFLAGS="-rdynamic"
+    TS_ADDTO(CPPFLAGS, [-I/usr/local/include])
+    TS_ADDTO(CPPFLAGS, [-Dkfreebsd])
+    ;;
+  openbsd*)
+    host_os_def="openbsd"
+    ;;
+  solaris*)
+    host_os_def="solaris"
+    case "`isalist`" in
+      *amd64*)
+        TS_ADDTO(CFLAGS, -m64)
+        TS_ADDTO(CXXFLAGS, -m64)
+        ;;
+    esac
+    ;;
+  *)
+    EXTRA_CXX_LDFLAGS="-rdynamic"
+    host_os_def=unknown
+    ;;
+esac
+
+TS_ADDTO(CPPFLAGS, [-D$host_os_def])
+AC_SUBST(defer_accept)
+
+
 dnl AM_PROG_AR is not always available, but it doesn't seem to be needed in older versions.
 ifdef([AM_PROG_AR],
       [AM_PROG_AR])
 
-
-AC_PROG_CPP
-AC_PROG_CXXCPP
-AM_PROG_AS
 AC_PROG_AWK
 AC_PROG_SED
 AC_PROG_LN_S
@@ -674,10 +720,10 @@ AM_CONDITIONAL([BUILD_HAVE_LIBCXX], [ false ])
 
 base_cc=`basename $CC`
 # These are shortcuts used in combination for the compiler options below
-case $host_os in
-  linux*)
+case $host_os_def in
+  linux)
     case $base_cc in
-    icc)
+    *icc*)
       # -Wall goes crazy, so turned these specific checks off for now:
       #
       #  111 is "statement is unrecahable"
@@ -700,7 +746,7 @@ case $host_os in
       release_opt="-g $common_opt $optimization_flags -axsse4.2 -fno-strict-aliasing"
       cxx_opt="-Wno-invalid-offsetof"
       ;;
-    clang)
+    *clang*)
       debug_opt="-ggdb3 $common_opt -Werror -Qunused-arguments"
       release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing -Werror -Qunused-arguments"
       cxx_opt="-Wno-invalid-offsetof -Werror -Qunused-arguments"
@@ -717,10 +763,10 @@ case $host_os in
       flex_cflags="-Wno-unused-parameter"
       ;;
     esac
-    ;; # linux*)
-  darwin*)
+    ;; # linux)
+  darwin)
     case $base_cc in
-    clang)
+    *clang*)
       common_opt="-pipe -Wall -Werror -Wno-deprecated-declarations"
       debug_opt="$common_opt"
       release_opt="-g $common_opt $optimizing_flags -fno-strict-aliasing"
@@ -738,10 +784,10 @@ case $host_os in
     # ToDo: This seems semi-kludgy, but useful for MacPort's I think.
     TS_ADDTO(CPPFLAGS, [-I/opt/local/include])
     TS_ADDTO(LDFLAGS, [-L/opt/local/lib])
-    ;; # darwin*)
-  freebsd*|kfreebsd*)
+    ;; # darwin)
+  freebsd|kfreebsd)
     case $base_cc in
-    clang)
+    *clang*)
       common_opt="-pipe -Wall -Werror -Qunused-arguments"
       debug_opt="-ggdb3 $common_opt"
       release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing"
@@ -755,10 +801,11 @@ case $host_os in
       ;;
     esac
     TS_ADDTO(LDFLAGS, [-L/usr/local/lib])
-    ;;
-  solaris*)
+    ;; # freebsd|kfreebsd)
+  solaris)
     if test "x${base_cc}" = "xcc"; then
-      common_opt="-mt -m64 -D__WORDSIZE=64" # FIXME: arch should be detected
+      # TODO: If we no longer support SunStudio, should this code go away?
+      common_opt="-mt -D__WORDSIZE=64" # FIXME: arch should be detected
       debug_opt="-g $common_opt"
       release_opt="-g $common_opt $optimizing_flags"
       cxx_opt="-library=stlport4"
@@ -771,11 +818,11 @@ case $host_os in
         postdeps_CXX="-library=Crun"
       fi
     else # gcc
-      common_opt="-pipe -Wall -Werror -m64"
+      common_opt="-pipe -Wall -Werror"
       debug_opt="-ggdb3 $common_opt"
       release_opt="-g $common_opt $optimizing_flags -feliminate-unused-debug-symbols -fno-strict-aliasing"
       cxx_opt="-Wno-invalid-offsetof"
-    fi
+    fi # solaris)
     ;;
   *)
     common_opt="-pipe -Wall -Werror"
@@ -802,26 +849,27 @@ SHARED_LDFLAGS=-shared
 SHARED_CXXFLAGS=-fPIC
 SHARED_CXXLINKFLAGS=-shared
 
-dnl Checks for pointer size
-AC_CHECK_SIZEOF(void*, 4)
+#
+# _Here_ is where we go ahead and add the _optimizations_ to already
+#  existing CFLAGS/CXXFLAGS if some special values had been set.
+#
+if test "x${enable_debug}" = "xyes"; then
+  TS_ADDTO(CFLAGS, [${cc_oflag_dbg}])
+  TS_ADDTO(CXXFLAGS, [${cxx_oflag_dbg}])
+  TS_ADDTO(CPPFLAGS, [-DDEBUG -D_DEBUG])
+else
+  TS_ADDTO(CFLAGS, [${cc_oflag_opt}])
+  TS_ADDTO(CXXFLAGS, [${cxx_oflag_opt}])
+fi
+
+# Checks for pointer size
+AC_CHECK_SIZEOF([void*])
 if test "x$ac_cv_sizeof_voidp" == "x"; then
   AC_ERROR([Cannot determine size of void*])
 fi
 AC_SUBST(ac_cv_sizeof_voidp)
 
 
-# Checks for TCP defer accept
-case $host_os in
-  linux*)
-    defer_accept=45
-    ;;
-  *)
-    defer_accept=1
-    ;;
-esac
-AC_SUBST(defer_accept)
-
-
 #
 # Here are all the extra linux-specific C(XX)FLAGS additions and
 # so forth.
@@ -890,52 +938,10 @@ fi
 TS_ADDTO(CPPFLAGS, [-D_GNU_SOURCE])
 TS_ADDTO(CPPFLAGS, [-D_REENTRANT])
 
-case $host_os in
-  linux*)
-    EXTRA_CXX_LDFLAGS="-rdynamic"
-    host_os_def=linux
-    ;;
-  darwin*)
-    host_os_def=darwin
-    ;;
-  freebsd*)
-    EXTRA_CXX_LDFLAGS="-rdynamic"
-    host_os_def=freebsd
-    ;;
-  kfreebsd*)
-    EXTRA_CXX_LDFLAGS="-rdynamic"
-    host_os_def=freebsd
-    TS_ADDTO(CPPFLAGS, [-Dkfreebsd])
-    ;;
-  solaris*)
-    host_os_def=solaris
-    ;;
-  openbsd*)
-    host_os_def=openbsd
-    ;;
-  *)
-    EXTRA_CXX_LDFLAGS="-rdynamic"
-    host_os_def=unknown
-   ;;
-esac
-TS_ADDTO(CPPFLAGS, [-D$host_os_def])
 
 AC_MSG_NOTICE([Build for host OS: $host_os, arch: $host_cpu, optimization: $host_os_def])
 
 #
-# _Here_ is where we go ahead and add the _optimizations_ to already
-#  existing CFLAGS/CXXFLAGS if some special values had been set.
-#
-if test "x${enable_debug}" = "xyes"; then
-  TS_ADDTO(CFLAGS, [${cc_oflag_dbg}])
-  TS_ADDTO(CXXFLAGS, [${cxx_oflag_dbg}])
-  TS_ADDTO(CPPFLAGS, [-DDEBUG -D_DEBUG])
-else
-  TS_ADDTO(CFLAGS, [${cc_oflag_opt}])
-  TS_ADDTO(CXXFLAGS, [${cxx_oflag_opt}])
-fi
-
-#
 # Note:  These are site-specific macro's that do various tests
 #         on the selected compilers.  There was some tunning
 #         associated with our not wanting to use GNU for _everything_.
@@ -1023,20 +1029,11 @@ SC_PATH_TCLCONFIG
 SC_LOAD_TCLCONFIG
 
 # expect tclConfig.sh to populate TCL_LIB_FLAG and TCL_INCLUDE_SPEC
-case $host_os in
-  darwin*)
+if test "$host_os_def" == "darwin"; then
     TCL_LIB_SPEC="-ltcl" # OSX fails to populate this variable
-    ;;
-  *)
-   ;;
-esac
+fi
 AC_SUBST([LIBTCL],[$TCL_LIB_SPEC])
 
-case $host_os in
-  freebsd*|kfreebsd*)
-    TS_ADDTO(CPPFLAGS, [-I/usr/local/include])
-    ;;
-esac
 
 if test "x${TCL_INCLUDE_SPEC}" != "x-I/usr/include"; then
    TS_ADDTO(CPPFLAGS, [$TCL_INCLUDE_SPEC])
@@ -1213,10 +1210,9 @@ AS_IF([test "x$enable_posix_cap" != "xno"],
 AC_SUBST(use_posix_cap)
 
 AS_IF([test "x$enable_linux_native_aio" = "xyes"], [
-  case $host_os in
-    linux*) ;;
-    *) AC_MSG_ERROR([Linux native AIO can only be enabled on Linux systems])
-  esac
+  if test $host_os_def  != "linux"; then
+    AC_MSG_ERROR([Linux native AIO can only be enabled on Linux systems])
+  fi
 
   AC_CHECK_HEADERS([libaio.h], [],
     [AC_MSG_ERROR([Linux native AIO requires libaio.h])]
@@ -1310,7 +1306,7 @@ AC_MSG_RESULT([$enable_lua_support])
 # On Darwin LuaJIT requires magic link options, otherwise it will crash in luaL_openlibs() at startup. See
 # http://luajit.org/install.html.
 case $host_os in
-  darwin*)
+  darwin)
     if test "x${have_luajit}" = "xyes"; then
       LUA_LUAJIT_LDFLAGS="-Wl,-pagezero_size,10000 -Wl,-image_base,100000000"
     fi


Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by Igor Galić <i....@brainsware.org>.
Well, this is now done!

TS-1872 / https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;a=commit;h=c400c884

----- Original Message -----
> On May 1, 2013, at 8:39 AM, Leif Hedstrom <zw...@apache.org> wrote:
> 
> > On 5/1/13 6:58 AM, James Peach wrote:
> >> On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org>
> >> wrote:
> >> 
> >>> Following this basic idea here
> >>> 
> >>>  http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
> >>> 
> >>> I'd like to add a build/base_compiler.m4 - that runs this
> >>> program:
> >>> 
> >>>    # include <stdio.h>
> >>>    int main (void) {
> >>>      printf (
> >>>    #if defined(__clang__)
> >>>      "clang"
> >>>    #elif defined (__GNUC__) || defined (__GNUG__)
> >>>      "gcc"
> >>>    #elif defined (__SUNPRO_C) || defined (__SUNPRO_CC)
> >>>      "sunproc"
> >>>    #elif defined (__ICC) || defined(__INTEL_COMPILER)
> >>>      "icc"
> >>>    #endif
> >>>      );
> >>>      return 0;
> >>>    }
> > 
> > 
> > In addition to what James said, I think order could matter here.
> > Like, I suspect that ICC might define some of the gcc flags in its
> > "compatibility" mode. As such, I'd imagine you ought to test for
> > most specific first (e.g. icc then sunpro then clang and last gcc)
> > ?
> 
> Yeh, the order matters ... clang masquerades as GCC pretty thoroughly
> 
> J

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by James Peach <jp...@apache.org>.
On May 1, 2013, at 8:39 AM, Leif Hedstrom <zw...@apache.org> wrote:

> On 5/1/13 6:58 AM, James Peach wrote:
>> On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org> wrote:
>> 
>>> Following this basic idea here
>>> 
>>>  http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
>>> 
>>> I'd like to add a build/base_compiler.m4 - that runs this program:
>>> 
>>>    # include <stdio.h>
>>>    int main (void) {
>>>      printf (
>>>    #if defined(__clang__)
>>>      "clang"
>>>    #elif defined (__GNUC__) || defined (__GNUG__)
>>>      "gcc"
>>>    #elif defined (__SUNPRO_C) || defined (__SUNPRO_CC)
>>>      "sunproc"
>>>    #elif defined (__ICC) || defined(__INTEL_COMPILER)
>>>      "icc"
>>>    #endif
>>>      );
>>>      return 0;
>>>    }
> 
> 
> In addition to what James said, I think order could matter here. Like, I suspect that ICC might define some of the gcc flags in its "compatibility" mode. As such, I'd imagine you ought to test for most specific first (e.g. icc then sunpro then clang and last gcc) ?

Yeh, the order matters ... clang masquerades as GCC pretty thoroughly

J

Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by Leif Hedstrom <zw...@apache.org>.
On 5/1/13 6:58 AM, James Peach wrote:
> On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org> wrote:
>
>> Following this basic idea here
>>
>>   http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
>>
>> I'd like to add a build/base_compiler.m4 - that runs this program:
>>
>>     # include <stdio.h>
>>     int main (void) {
>>       printf (
>>     #if defined(__clang__)
>>       "clang"
>>     #elif defined (__GNUC__) || defined (__GNUG__)
>>       "gcc"
>>     #elif defined (__SUNPRO_C) || defined (__SUNPRO_CC)
>>       "sunproc"
>>     #elif defined (__ICC) || defined(__INTEL_COMPILER)
>>       "icc"
>>     #endif
>>       );
>>       return 0;
>>     }


In addition to what James said, I think order could matter here. Like, I 
suspect that ICC might define some of the gcc flags in its 
"compatibility" mode. As such, I'd imagine you ought to test for most 
specific first (e.g. icc then sunpro then clang and last gcc) ?

But +1 from me.

-- Leif


Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by James Peach <jp...@apache.org>.
On May 1, 2013, at 10:18 AM, Igor Galić <i....@brainsware.org> wrote:

> 
> 
> ----- Original Message -----
>> Wednesday, May 1, 2013, 8:58:50 AM, you wrote:
>> 
>>> On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org>
>>> wrote:
>> 
>> 
>>>> Following this basic idea here
>> 
>>>> http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
>> 
>> 
>>> This is a great idea. You should be able to implement it with only
>>> compilation; running a program makes life harder for cross
>>> compiling ...
>> 
>> By wrapping broken code with the appropriate #define and checking for
>> compilation success?
> 
> m4_define([_TS_C_COMPILE_INTEL_testbody], [
> int main (void) {
> # if !defined(__icc) || !defined()
>  This should fail if it's the compiler isn't Intel C/C++ Compiler
> # endif
> }
> ])
> 
> Like so?

Exactly!


Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Wednesday, May 1, 2013, 8:58:50 AM, you wrote:
> 
> > On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org>
> > wrote:
> 
> 
> >> Following this basic idea here
> 
> >>  http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
> 
> 
> > This is a great idea. You should be able to implement it with only
> > compilation; running a program makes life harder for cross
> > compiling ...
> 
> By wrapping broken code with the appropriate #define and checking for
> compilation success?

m4_define([_TS_C_COMPILE_INTEL_testbody], [
int main (void) {
# if !defined(__icc) || !defined()
  This should fail if it's the compiler isn't Intel C/C++ Compiler
# endif
}
])

Like so?

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by "Alan M. Carroll" <am...@network-geographics.com>.
Wednesday, May 1, 2013, 8:58:50 AM, you wrote:

> On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org> wrote:


>> Following this basic idea here

>>  http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros


> This is a great idea. You should be able to implement it with only compilation; running a program makes life harder for cross compiling ...

By wrapping broken code with the appropriate #define and checking for compilation success?


Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by James Peach <ja...@me.com>.
On May 1, 2013, at 12:48 AM, Igor Galić <i....@brainsware.org> wrote:

> 
> Following this basic idea here
> 
>  http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
> 
> I'd like to add a build/base_compiler.m4 - that runs this program:
> 
>    # include <stdio.h>
>    int main (void) {
>      printf (
>    #if defined(__clang__)
>      "clang"
>    #elif defined (__GNUC__) || defined (__GNUG__)
>      "gcc"
>    #elif defined (__SUNPRO_C) || defined (__SUNPRO_CC)
>      "sunproc"
>    #elif defined (__ICC) || defined(__INTEL_COMPILER)
>      "icc"
>    #endif
>      );
>      return 0;
>    }
> 
> To normalize our base_cc which we then can use as before:
> 
>    igalic@tynix /tmp % gcc comp.cc
>    igalic@tynix /tmp % ./a.out
>    gcc%
>    igalic@tynix /tmp % clang comp.cc
>    igalic@tynix /tmp % ./a.out
>    clang%
>    igalic@tynix /tmp %
> 
> 
> Objections?

This is a great idea. You should be able to implement it with only compilation; running a program makes life harder for cross compiling ...


> 
> ----- Original Message -----
>> On Apr 29, 2013, at 11:22 PM, Igor Galić <i....@brainsware.org>
>> wrote:
>> 
>>> 
>>> 
>>> ----- Original Message -----
>>>> Updated Branches:
>>>> refs/heads/master 54b532b64 -> d8c526233
>>>> 
>>>> 
>>>> TS-1864 Rearrange some of the autoconf code, order matters
>>> [snip]
>>>> Branch: refs/heads/master
>>>> Commit: d8c5262331e0654097640982100f43731e7e8f6d
>>>> Parents: 54b532b
>>>> Author: Leif Hedstrom <zw...@apache.org>
>>>> Authored: Mon Apr 29 17:00:51 2013 -0600
>>>> Committer: Leif Hedstrom <zw...@apache.org>
>>>> Committed: Mon Apr 29 22:07:27 2013 -0600
>>> 
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>> @@ -674,10 +720,10 @@ AM_CONDITIONAL([BUILD_HAVE_LIBCXX], [ false
>>>> ])
>>>> 
>>>> base_cc=`basename $CC`
>>>> # These are shortcuts used in combination for the compiler options
>>>> below
>>> 
>>> 
>>> I hope we can all agree that using the compilers name on the
>>> filesystem is a BAD way determine which compiler we're dealing
>>> with.
>> 
>> Yep. Amongst other things, this behaves really badly with clang's
>> scan-build. We have https://issues.apache.org/jira/browse/TS-1838
>> open to address this.
>> 
>> J
> 
> -- 
> Igor Galić
> 
> Tel: +43 (0) 664 886 22 883
> Mail: i.galic@brainsware.org
> URL: http://brainsware.org/
> GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by Igor Galić <i....@brainsware.org>.
Following this basic idea here

  http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros

I'd like to add a build/base_compiler.m4 - that runs this program:

    # include <stdio.h>
    int main (void) {
      printf (
    #if defined(__clang__)
      "clang"
    #elif defined (__GNUC__) || defined (__GNUG__)
      "gcc"
    #elif defined (__SUNPRO_C) || defined (__SUNPRO_CC)
      "sunproc"
    #elif defined (__ICC) || defined(__INTEL_COMPILER)
      "icc"
    #endif
      );
      return 0;
    }

To normalize our base_cc which we then can use as before:

    igalic@tynix /tmp % gcc comp.cc
    igalic@tynix /tmp % ./a.out
    gcc%
    igalic@tynix /tmp % clang comp.cc
    igalic@tynix /tmp % ./a.out
    clang%
    igalic@tynix /tmp %


Objections?

----- Original Message -----
> On Apr 29, 2013, at 11:22 PM, Igor Galić <i....@brainsware.org>
> wrote:
> 
> > 
> > 
> > ----- Original Message -----
> >> Updated Branches:
> >>  refs/heads/master 54b532b64 -> d8c526233
> >> 
> >> 
> >> TS-1864 Rearrange some of the autoconf code, order matters
> >> 
> > [snip]
> >> Branch: refs/heads/master
> >> Commit: d8c5262331e0654097640982100f43731e7e8f6d
> >> Parents: 54b532b
> >> Author: Leif Hedstrom <zw...@apache.org>
> >> Authored: Mon Apr 29 17:00:51 2013 -0600
> >> Committer: Leif Hedstrom <zw...@apache.org>
> >> Committed: Mon Apr 29 22:07:27 2013 -0600
> > 
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -674,10 +720,10 @@ AM_CONDITIONAL([BUILD_HAVE_LIBCXX], [ false
> >> ])
> >> 
> >> base_cc=`basename $CC`
> >> # These are shortcuts used in combination for the compiler options
> >> below
> > 
> > 
> > I hope we can all agree that using the compilers name on the
> > filesystem is a BAD way determine which compiler we're dealing
> > with.
> 
> Yep. Amongst other things, this behaves really badly with clang's
> scan-build. We have https://issues.apache.org/jira/browse/TS-1838
> open to address this.
> 
> J

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by James Peach <jp...@apache.org>.
On Apr 29, 2013, at 11:22 PM, Igor Galić <i....@brainsware.org> wrote:

> 
> 
> ----- Original Message -----
>> Updated Branches:
>>  refs/heads/master 54b532b64 -> d8c526233
>> 
>> 
>> TS-1864 Rearrange some of the autoconf code, order matters
>> 
> [snip]
>> Branch: refs/heads/master
>> Commit: d8c5262331e0654097640982100f43731e7e8f6d
>> Parents: 54b532b
>> Author: Leif Hedstrom <zw...@apache.org>
>> Authored: Mon Apr 29 17:00:51 2013 -0600
>> Committer: Leif Hedstrom <zw...@apache.org>
>> Committed: Mon Apr 29 22:07:27 2013 -0600
> 
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -674,10 +720,10 @@ AM_CONDITIONAL([BUILD_HAVE_LIBCXX], [ false ])
>> 
>> base_cc=`basename $CC`
>> # These are shortcuts used in combination for the compiler options
>> below
> 
> 
> I hope we can all agree that using the compilers name on the
> filesystem is a BAD way determine which compiler we're dealing with.

Yep. Amongst other things, this behaves really badly with clang's scan-build. We have https://issues.apache.org/jira/browse/TS-1838 open to address this.

J

Re: git commit: TS-1864 Rearrange some of the autoconf code, order matters

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Updated Branches:
>   refs/heads/master 54b532b64 -> d8c526233
> 
> 
> TS-1864 Rearrange some of the autoconf code, order matters
> 
[snip]
> Branch: refs/heads/master
> Commit: d8c5262331e0654097640982100f43731e7e8f6d
> Parents: 54b532b
> Author: Leif Hedstrom <zw...@apache.org>
> Authored: Mon Apr 29 17:00:51 2013 -0600
> Committer: Leif Hedstrom <zw...@apache.org>
> Committed: Mon Apr 29 22:07:27 2013 -0600

> --- a/configure.ac
> +++ b/configure.ac
> @@ -674,10 +720,10 @@ AM_CONDITIONAL([BUILD_HAVE_LIBCXX], [ false ])
>  
>  base_cc=`basename $CC`
>  # These are shortcuts used in combination for the compiler options
>  below


I hope we can all agree that using the compilers name on the
filesystem is a BAD way determine which compiler we're dealing with.

> -case $host_os in
> -  linux*)
> +case $host_os_def in
> +  linux)
>      case $base_cc in
> -    icc)
> +    *icc*)
>        # -Wall goes crazy, so turned these specific checks off for
>        now:
>        #
>        #  111 is "statement is unrecahable"
> @@ -700,7 +746,7 @@ case $host_os in
>        release_opt="-g $common_opt $optimization_flags -axsse4.2
>        -fno-strict-aliasing"
>        cxx_opt="-Wno-invalid-offsetof"
>        ;;
> -    clang)
> +    *clang*)
>        debug_opt="-ggdb3 $common_opt -Werror -Qunused-arguments"
>        release_opt="-g $common_opt $optimizing_flags
>        -fno-strict-aliasing -Werror -Qunused-arguments"
>        cxx_opt="-Wno-invalid-offsetof -Werror -Qunused-arguments"
> @@ -717,10 +763,10 @@ case $host_os in
>        flex_cflags="-Wno-unused-parameter"
>        ;;
>      esac
> -    ;; # linux*)
> -  darwin*)
> +    ;; # linux)
> +  darwin)
>      case $base_cc in
> -    clang)
> +    *clang*)
>        common_opt="-pipe -Wall -Werror -Wno-deprecated-declarations"
>        debug_opt="$common_opt"
>        release_opt="-g $common_opt $optimizing_flags
>        -fno-strict-aliasing"
> @@ -738,10 +784,10 @@ case $host_os in
>      # ToDo: This seems semi-kludgy, but useful for MacPort's I
>      think.
>      TS_ADDTO(CPPFLAGS, [-I/opt/local/include])
>      TS_ADDTO(LDFLAGS, [-L/opt/local/lib])
> -    ;; # darwin*)
> -  freebsd*|kfreebsd*)
> +    ;; # darwin)
> +  freebsd|kfreebsd)
>      case $base_cc in
> -    clang)
> +    *clang*)
>        common_opt="-pipe -Wall -Werror -Qunused-arguments"
>        debug_opt="-ggdb3 $common_opt"
>        release_opt="-g $common_opt $optimizing_flags
>        -feliminate-unused-debug-symbols -fno-strict-aliasing"
> @@ -755,10 +801,11 @@ case $host_os in
>        ;;
>      esac
>      TS_ADDTO(LDFLAGS, [-L/usr/local/lib])
> -    ;;
> -  solaris*)
> +    ;; # freebsd|kfreebsd)
> +  solaris)
>      if test "x${base_cc}" = "xcc"; then
> -      common_opt="-mt -m64 -D__WORDSIZE=64" # FIXME: arch should be
> detected
> +      # TODO: If we no longer support SunStudio, should this code go
> away?
> +      common_opt="-mt -D__WORDSIZE=64" # FIXME: arch should be
> detected
>        debug_opt="-g $common_opt"
>        release_opt="-g $common_opt $optimizing_flags"
>        cxx_opt="-library=stlport4"
> @@ -771,11 +818,11 @@ case $host_os in
>          postdeps_CXX="-library=Crun"
>        fi
>      else # gcc
> -      common_opt="-pipe -Wall -Werror -m64"
> +      common_opt="-pipe -Wall -Werror"
>        debug_opt="-ggdb3 $common_opt"
>        release_opt="-g $common_opt $optimizing_flags
>        -feliminate-unused-debug-symbols -fno-strict-aliasing"
>        cxx_opt="-Wno-invalid-offsetof"
> -    fi
> +    fi # solaris)
>      ;;
>    *)
>      common_opt="-pipe -Wall -Werror"
> @@ -802,26 +849,27 @@ SHARED_LDFLAGS=-shared

-- i
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE