GNOME Bugzilla – Bug 792718
[PATCH] Don't declare functions in AC_TRY_COMPILE
Last modified: 2018-01-24 09:20:05 UTC
Please see the patch. Declaring functions in AC_TRY_COMPILE causes the test for -fvisibility=hidden to fail on Clang. AC_TRY_COMPILE puts code to test in the main function, so instead of using 'int main (void) { return 0; }' as test program, we must use 'return 0' without declaring any function. If we declare main function there, it becomes a nested main function inside the global main function. It is supported by GCC, but not by Clang. This causes problems when checking compiler flags: checking for -fvisibility=hidden compiler flag... no
Created attachment 367141 [details] [review] configure: Don't declare functions in AC_TRY_COMPILE (master branch)
Created attachment 367142 [details] [review] configure: Don't declare functions in AC_TRY_COMPILE (gnome-3-24 branch)
Review of attachment 367141 [details] [review]: After reading the Autoconf documentation for AC_TRY_COMPILE, it's not clear how the macro behaves. But it probably uses a macro similar to AC_LANG_PROGRAM, so your patch looks good.
Review of attachment 367142 [details] [review]: Ditto.
Attachment 367141 [details] pushed as 5349b3d - configure: Don't declare functions in AC_TRY_COMPILE Attachment 367142 [details] pushed as ee90812 - configure: Don't declare functions in AC_TRY_COMPILE
For the record, tested on Linux with GCC: checking for -fvisibility=hidden compiler flag... yes so it works fine.