Re: Testing for compiler capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

>> is there a simple macro that will test for a specific compiler flag and set
>> a variable in both Makefile and config.h?
>> I am looking for an easy way to test for GCC's -fvisibility=hidden and
>> have an indicator whether or not it is available in said files.
>
>	Here's (attached) a test for visibility attributes instead of
>visibility flags, which might give the same effect.  It defines the
>config.h variables HAVE_ATTRIBUTE_VISIBILITY_HIDDEN and
>HAVE_ATTRIBUTE_VISIBILITY_DEFAULT if the respective attributes are
>understood.  You can easily add an AM_CONDITIONAL to it as well.  This
>particular test runs in C++ mode.  I had to temporarily add the -Werror
>flag to the compile flags to make the compiler reject warnings about
>unsupported attributes.  Feedback is welcome.

I am afraid using -Werror does not work, it really needs -fvis.. on the 
command line:

$ cat x.c
int __attribute__((visibility("hidden"))) mx(void) { return 1337; }
$ cc -c x.c -Wall -Werror
(No error)
$ cc -c x.c -Wall -Werror -fvisibility=hidden
cc1: error: unrecognized option `-fvisibility=hidden'



Jan Engelhardt
-- 


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux