From dcf4e242e88a256c645e5a9047acda747f3cbeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= <gael@xfce.org> Date: Tue, 7 Jan 2025 12:45:25 +0100 Subject: [PATCH] build: Add missing update of --enable-visibility flag Fixes: 54d0c348c643e5dc204dc4fc69922c5f616ebf04 --- configure.ac | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 3205d0b..220513b 100644 --- a/configure.ac +++ b/configure.ac @@ -151,22 +151,27 @@ dnl *** Do not replace with the Xdt macro *** dnl *** because it cannot cope with the *** dnl *** libxfce4util_*_version variables *** dnl ***************************************** -AC_ARG_ENABLE([visibility], AS_HELP_STRING([--disable-visibility], [Do not use ELF visibility attributes]), [], [enable_visibility=yes]) +AC_ARG_ENABLE([visibility], + AS_HELP_STRING([--disable-visibility], + [Do not use ELF visibility attributes]), + [enable_visibility=$enableval], [enable_visibility=yes]) have_gnuc_visibility=no -if test x"$enable_visibility" != x"no"; then - dnl Check whether the compiler supports the visibility attribute - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wall -Werror" +if test "x$enable_visibility" != "xno"; then + XDT_SUPPORTED_FLAGS([xdt_vis_test_cflags], [-Wall -Werror -Wno-unused-parameter -fvisibility=hidden]) + saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $xdt_vis_test_cflags" AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute]) AC_COMPILE_IFELSE([AC_LANG_SOURCE( [ - void test_default (void); - void test_hidden (void); - - void __attribute__ ((visibility("default"))) test_default (void) {} - void __attribute__ ((visibility("hidden"))) test_hidden (void) {} - - int main (int argc, char **argv) { test_default (); test_hidden (); return 0; } + void test_default(void); + void test_hidden(void); + void __attribute__((visibility("default"))) test_default(void) {} + void __attribute__((visibility("hidden"))) test_hidden(void) {} + int main(int argc, char **argv) { + test_default(); + test_hidden(); + return 0; + } ])], [ have_gnuc_visibility=yes @@ -175,12 +180,12 @@ if test x"$enable_visibility" != x"no"; then [ AC_MSG_RESULT([no]) ]) - CFLAGS="$save_CFLAGS" + CFLAGS="$saved_CFLAGS" fi -if test x"$have_gnuc_visibility" = x"yes"; then - CPPFLAGS="$CPPFLAGS -DHAVE_GNUC_VISIBILITY" +if test "x$have_gnuc_visibility" = "xyes"; then + CPPFLAGS="$CPPFLAGS -DENABLE_SYMBOL_VISIBILITY=1" + CFLAGS="$CFLAGS -fvisibility=hidden" fi -AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test x"$have_gnuc_visibility" = x"yes"]) dnl ***************************** dnl *** Generate output files *** -- GitLab