diff mbox

[libdrm,01/24] configure.ac: split -fvisibility and __attribute__((visibility)) checks

Message ID 1427904935-14387-2-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov April 1, 2015, 4:15 p.m. UTC
The former does not imply the latter and vice-versa. One such example is
the Sun compiler.

v2: Add missing closing brakets. (Alan)

Cc: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 configure.ac | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Alan Coopersmith April 8, 2015, 12:18 a.m. UTC | #1
On 04/ 1/15 09:15 AM, Emil Velikov wrote:
> The former does not imply the latter and vice-versa. One such example is
> the Sun compiler.
>
> v2: Add missing closing brakets. (Alan)

s/brakets/brackets/

Other than that, looks good to me.

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

>
> Cc: Alan Coopersmith <alan.coopersmith@oracle.com>
> Cc: Thierry Reding <treding@nvidia.com>
> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
> ---
>   configure.ac | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 155d577..76cf91e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -415,12 +415,17 @@ if test "x$GCC" = xyes; then
>
>       # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
>       CFLAGS=$save_CFLAGS
> +    AC_SUBST([VISIBILITY_CFLAGS])
> +fi
>
> -    if test "x$VISIBILITY_CFLAGS" != x; then
> -        AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler has -fvisibility support])
> -    fi
> +AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
> +AC_LINK_IFELSE([AC_LANG_PROGRAM([
> +    int foo_default( void ) __attribute__((visibility("default")));
> +    int foo_hidden( void ) __attribute__((visibility("hidden")));
> +])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]));
>
> -    AC_SUBST([VISIBILITY_CFLAGS])
> +if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
> +    AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__((visibility))])
>   fi
>
>   AC_SUBST(WARN_CFLAGS)
>
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 155d577..76cf91e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,12 +415,17 @@  if test "x$GCC" = xyes; then
 
     # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
     CFLAGS=$save_CFLAGS
+    AC_SUBST([VISIBILITY_CFLAGS])
+fi
 
-    if test "x$VISIBILITY_CFLAGS" != x; then
-        AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler has -fvisibility support])
-    fi
+AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+    int foo_default( void ) __attribute__((visibility("default")));
+    int foo_hidden( void ) __attribute__((visibility("hidden")));
+])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]));
 
-    AC_SUBST([VISIBILITY_CFLAGS])
+if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
+    AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__((visibility))])
 fi
 
 AC_SUBST(WARN_CFLAGS)