[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Compiler flag detection doesn't work

From: Branko Čibej <brane_at_wandisco.com>
Date: Sat, 01 Mar 2014 04:08:02 +0100

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_at_wandisco.com
Received on 2014-03-01 04:08:41 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.