[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marc Abramowitz updated TS-1091:
--------------------------------

    Description: 
{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
...
checking style of gethostbyname_r routine... glibc2
checking 3rd argument to the gethostbyname_r routines... hostent_data
configure: Build using CC=/usr/bin/llvm-gcc
configure: Build using CXX=/usr/bin/llvm-g++
configure: Build using CPP=/usr/bin/llvm-gcc -E
configure: Build using CFLAGS=-O3 -w -pipe -march=core2 -msse4 -g -Wall -Werror 
-feliminate-unused-debug-symbols -fno-strict-aliasing
configure: Build using SHARED_CFLAGS=-fPIC
configure: Build using CXXFLAGS=-O3 -w -pipe -march=core2 -msse4 -g -Wall 
-Werror -feliminate-unused-debug-symbols -fno-strict-aliasing 
-Wno-invalid-offsetof
...
{code}

Arguably, people should never run configure with CFLAGS=-w and this might seem 
stupid and something that should never happen, but it turns out that Homebrew 
(http://mxcl.github.com/homebrew/) does this by default 
(https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
writing a Homebrew formula for Traffic Server 
(https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
causing problems, I modified my formula to tell Homebrew not to do this and all 
is well, but I thought it would be interesting to make Traffic Server resistant 
to this as well.

I first tried to enable warnings by trying to find a gcc #pragma that could go 
in the conftest.c code, but I could not find any #pragma that seemed to do this.

I ended up making a small change to `build/common.m4` that strips -w out of 
CFLAGS using `sed`.

{code}
--- build/common.m4.2012-01-22-092051   2011-05-25 13:19:54.000000000 -0700
+++ build/common.m4     2012-01-22 22:48:14.000000000 -0800
@@ -177,6 +177,7 @@
  if test "$ac_cv_prog_gcc" = "yes"; then
    CFLAGS="$CFLAGS -Werror"
  fi
+ CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ 
-w / /')
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
   [#include "confdefs.h"
   ]
{code}

  was:
Arguably, people should never run configure with CFLAGS=-w and this might seem 
stupid and something that should never happen, but it turns out that Homebrew 
(http://mxcl.github.com/homebrew/) does this by default 
(https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
writing a Homebrew formula for Traffic Server 
(https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
causing problems, I modified my formula to tell Homebrew not to do this and all 
is well, but I thought it would be interesting to make Traffic Server resistant 
to this as well.

I first tried to enable warnings by trying to find a gcc #pragma that could go 
in the conftest.c code, but I could not find any #pragma that seemed to do this.

I ended up making a small change to `build/common.m4` that strips -w out of 
CFLAGS using `sed`.

{code}
--- build/common.m4.2012-01-22-092051   2011-05-25 13:19:54.000000000 -0700
+++ build/common.m4     2012-01-22 22:48:14.000000000 -0800
@@ -177,6 +177,7 @@
  if test "$ac_cv_prog_gcc" = "yes"; then
    CFLAGS="$CFLAGS -Werror"
  fi
+ CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ 
-w / /')
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
   [#include "confdefs.h"
   ]
{code}

    
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TS-1091
>                 URL: https://issues.apache.org/jira/browse/TS-1091
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 3.0.2
>         Environment: OS X 10.6.8
>            Reporter: Marc Abramowitz
>            Priority: Minor
>              Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=/usr/bin/llvm-gcc
> configure: Build using CXX=/usr/bin/llvm-g++
> configure: Build using CPP=/usr/bin/llvm-gcc -E
> configure: Build using CFLAGS=-O3 -w -pipe -march=core2 -msse4 -g -Wall 
> -Werror -feliminate-unused-debug-symbols -fno-strict-aliasing
> configure: Build using SHARED_CFLAGS=-fPIC
> configure: Build using CXXFLAGS=-O3 -w -pipe -march=core2 -msse4 -g -Wall 
> -Werror -feliminate-unused-debug-symbols -fno-strict-aliasing 
> -Wno-invalid-offsetof
> ...
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code, but I could not find any #pragma that seemed to do 
> this.
> I ended up making a small change to `build/common.m4` that strips -w out of 
> CFLAGS using `sed`.
> {code}
> --- build/common.m4.2012-01-22-092051 2011-05-25 13:19:54.000000000 -0700
> +++ build/common.m4   2012-01-22 22:48:14.000000000 -0800
> @@ -177,6 +177,7 @@
>   if test "$ac_cv_prog_gcc" = "yes"; then
>     CFLAGS="$CFLAGS -Werror"
>   fi
> + CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 
> 's/ -w / /')
>   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
>    [#include "confdefs.h"
>    ]
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to