You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (Commented) (JIRA)" <ji...@apache.org> on 2012/01/23 18:06:40 UTC

[jira] [Commented] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

    [ https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191256#comment-13191256 ] 

Leif Hedstrom commented on TS-1091:
-----------------------------------

Would it not be possible to make a regex that captures all the "cases"? Perhaps something like (untested)

s/ *-w */ /g

? It means we might have an additional whitespace in the CFLAGs, but that seems ok :).
                
> `./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$ system_profiler -detailLevel mini | grep 'System Version'
>       System Version: Mac OS X 10.6.8 (10K549)
> 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=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing...
> {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