summaryrefslogtreecommitdiffstats
path: root/gl/m4/visibility.m4
diff options
context:
space:
mode:
authorKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-19 22:49:18 (GMT)
committerKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-19 22:49:18 (GMT)
commita0d42777217296c0a7bdb1e1be8d8f6de1b24dd7 (patch)
tree8effe94c57b2f9796ba36090b07551baa8f1e1cb /gl/m4/visibility.m4
parentca3d59cd6918c9e2739e783b721d4c1122640fd3 (diff)
parentc07206f2ccc2356aa74bc6813a94c2190017d44e (diff)
downloadmonitoring-plugins-a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7.tar.gz
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option
Diffstat (limited to 'gl/m4/visibility.m4')
-rw-r--r--gl/m4/visibility.m479
1 files changed, 42 insertions, 37 deletions
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
index 6cbd7e5..f0468e8 100644
--- a/gl/m4/visibility.m4
+++ b/gl/m4/visibility.m4
@@ -1,5 +1,5 @@
1# visibility.m4 serial 5 (gettext-0.18.2) 1# visibility.m4 serial 8
2dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -29,42 +29,47 @@ AC_DEFUN([gl_VISIBILITY],
29 dnl First, check whether -Werror can be added to the command line, or 29 dnl First, check whether -Werror can be added to the command line, or
30 dnl whether it leads to an error because of some other option that the 30 dnl whether it leads to an error because of some other option that the
31 dnl user has put into $CC $CFLAGS $CPPFLAGS. 31 dnl user has put into $CC $CFLAGS $CPPFLAGS.
32 AC_MSG_CHECKING([whether the -Werror option is usable]) 32 AC_CACHE_CHECK([whether the -Werror option is usable],
33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [ 33 [gl_cv_cc_vis_werror],
34 gl_save_CFLAGS="$CFLAGS" 34 [gl_save_CFLAGS="$CFLAGS"
35 CFLAGS="$CFLAGS -Werror" 35 CFLAGS="$CFLAGS -Werror"
36 AC_COMPILE_IFELSE( 36 AC_COMPILE_IFELSE(
37 [AC_LANG_PROGRAM([[]], [[]])], 37 [AC_LANG_PROGRAM([[]], [[]])],
38 [gl_cv_cc_vis_werror=yes], 38 [gl_cv_cc_vis_werror=yes],
39 [gl_cv_cc_vis_werror=no]) 39 [gl_cv_cc_vis_werror=no])
40 CFLAGS="$gl_save_CFLAGS"]) 40 CFLAGS="$gl_save_CFLAGS"
41 AC_MSG_RESULT([$gl_cv_cc_vis_werror]) 41 ])
42 dnl Now check whether visibility declarations are supported. 42 dnl Now check whether visibility declarations are supported.
43 AC_MSG_CHECKING([for simple visibility declarations]) 43 AC_CACHE_CHECK([for simple visibility declarations],
44 AC_CACHE_VAL([gl_cv_cc_visibility], [ 44 [gl_cv_cc_visibility],
45 gl_save_CFLAGS="$CFLAGS" 45 [gl_save_CFLAGS="$CFLAGS"
46 CFLAGS="$CFLAGS -fvisibility=hidden" 46 CFLAGS="$CFLAGS -fvisibility=hidden"
47 dnl We use the option -Werror and a function dummyfunc, because on some 47 dnl We use the option -Werror and a function dummyfunc, because on some
48 dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning 48 dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
49 dnl "visibility attribute not supported in this configuration; ignored" 49 dnl "visibility attribute not supported in this configuration; ignored"
50 dnl at the first function definition in every compilation unit, and we 50 dnl at the first function definition in every compilation unit, and we
51 dnl don't want to use the option in this case. 51 dnl don't want to use the option in this case.
52 if test $gl_cv_cc_vis_werror = yes; then 52 if test $gl_cv_cc_vis_werror = yes; then
53 CFLAGS="$CFLAGS -Werror" 53 CFLAGS="$CFLAGS -Werror"
54 fi 54 fi
55 AC_COMPILE_IFELSE( 55 AC_COMPILE_IFELSE(
56 [AC_LANG_PROGRAM( 56 [AC_LANG_PROGRAM(
57 [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; 57 [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
58 extern __attribute__((__visibility__("default"))) int exportedvar; 58 extern __attribute__((__visibility__("default"))) int exportedvar;
59 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 59 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
60 extern __attribute__((__visibility__("default"))) int exportedfunc (void); 60 extern __attribute__((__visibility__("default"))) int exportedfunc (void);
61 void dummyfunc (void) {} 61 void dummyfunc (void);
62 ]], 62 int hiddenvar;
63 [[]])], 63 int exportedvar;
64 [gl_cv_cc_visibility=yes], 64 int hiddenfunc (void) { return 51; }
65 [gl_cv_cc_visibility=no]) 65 int exportedfunc (void) { return 1225736919; }
66 CFLAGS="$gl_save_CFLAGS"]) 66 void dummyfunc (void) {}
67 AC_MSG_RESULT([$gl_cv_cc_visibility]) 67 ]],
68 [[]])],
69 [gl_cv_cc_visibility=yes],
70 [gl_cv_cc_visibility=no])
71 CFLAGS="$gl_save_CFLAGS"
72 ])
68 if test $gl_cv_cc_visibility = yes; then 73 if test $gl_cv_cc_visibility = yes; then
69 CFLAG_VISIBILITY="-fvisibility=hidden" 74 CFLAG_VISIBILITY="-fvisibility=hidden"
70 HAVE_VISIBILITY=1 75 HAVE_VISIBILITY=1