You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@wandisco.com> on 2014/03/01 04:05:37 UTC

Re: Compiler flag detection doesn't work

On 28.02.2014 22:55, Philip Martin wrote:
> In configure.as we attempt to add compiler flags by detecting whether or
> not the compiler accepts them.  It's unreliable on Solaris:
>
>     SVN_CFLAGS_ADD_IFELSE([-fno-inline])
>     SVN_CFLAGS_ADD_IFELSE([-fno-omit-frame-pointer])
>
> $ touch x.c
> $ cc -c -fno-omit-frame-pointer x.c
> cc: Warning: Option -fomit-frame-pointer passed to ld, if ld is invoked, ignored otherwise
> "x.c", line 1: warning: empty translation unit
> $ echo $?
> 0
>
> I think that counts as working as far as SVN_CFLAGS_ADD_IFELSE is
> concerned, these flags certainly get added.
>
> However adding these flags causes the compiler to fail to link:
>
> $ echo 'int main(){}' > x.c
> $ cc -fomit-frame-pointer x.c
> cc: Warning: Option -fomit-frame-pointer passed to ld, if ld is invoked, ignored otherwise
> ld: fatal: option -f and building a dynamic executable are incompatible
> ld: fatal: Flags processing errors
>
> So we have to get SVN_CFLAGS_ADD_IFELSE to recognise that these flags
> should not be added.  I suppose we could change the AC_COMPILE_IFELSE to
> an AC_LINK_IFELSE.

Actually, we should really only be setting these flags if $GCC is
defined in the configure script (or $GXX for the C++ equivalent).

-- Brane


-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com

Re: Compiler flag detection doesn't work

Posted by Branko Čibej <br...@wandisco.com>.
On 01.03.2014 04:05, Branko Čibej wrote:
> On 28.02.2014 22:55, Philip Martin wrote:
>> In configure.as we attempt to add compiler flags by detecting whether or
>> not the compiler accepts them.  It's unreliable on Solaris:
>>
>>     SVN_CFLAGS_ADD_IFELSE([-fno-inline])
>>     SVN_CFLAGS_ADD_IFELSE([-fno-omit-frame-pointer])
>>
>> $ touch x.c
>> $ cc -c -fno-omit-frame-pointer x.c
>> cc: Warning: Option -fomit-frame-pointer passed to ld, if ld is invoked, ignored otherwise
>> "x.c", line 1: warning: empty translation unit
>> $ echo $?
>> 0
>>
>> I think that counts as working as far as SVN_CFLAGS_ADD_IFELSE is
>> concerned, these flags certainly get added.
>>
>> However adding these flags causes the compiler to fail to link:
>>
>> $ echo 'int main(){}' > x.c
>> $ cc -fomit-frame-pointer x.c
>> cc: Warning: Option -fomit-frame-pointer passed to ld, if ld is invoked, ignored otherwise
>> ld: fatal: option -f and building a dynamic executable are incompatible
>> ld: fatal: Flags processing errors
>>
>> So we have to get SVN_CFLAGS_ADD_IFELSE to recognise that these flags
>> should not be added.  I suppose we could change the AC_COMPILE_IFELSE to
>> an AC_LINK_IFELSE.
>
> Actually, we should really only be setting these flags if $GCC is
> defined in the configure script (or $GXX for the C++ equivalent).

BTW, we already check these conditions when setting the maintainer-mode
flags. So we only need to check during initial compiler setup, and
possibly for the --enable-debug/--enable-optimize processing.

-- Brane


-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com