configury: Use only one copy of CHECK_ATTRIBUTE_VISIBILITY macro

Currently libatomic, libgfortran, libgomp, and libitm have a version
of the CHECK_ATTRIBUTE_VISIBILITY macro.

Put the macro in its own file and have all libraries use it.

config/ChangeLog:

	* visibility.m4: New file.

libatomic/ChangeLog:

	* Makefile.in: Regenerate.
	* acinclude.m4: Delete LIBAT_CHECK_ATTRIBUTE_VISIBILITY.
	* aclocal.m4: Regenerate.
	* configure: Likewise.
	* configure.ac: Use GCC_CHECK_ATTRIBUTE_VISIBILITY instead of
	LIBAT_CHECK_ATTRIBUTE_VISIBILITY.
	* testsuite/Makefile.in: Regenerate.

libgfortran/ChangeLog:

	* Makefile.in: Regenerate.
	* acinclude.m4: Delete LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY.
	* aclocal.m4: Regenerate.
	* configure: Likewise.
	* configure.ac: Use GCC_CHECK_ATTRIBUTE_VISIBILITY istead of
	LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY.

libgomp/ChangeLog:

	* Makefile.in: Regenerate.
	* acinclude.m4: Delete LIGOMP_CHECK_ATTRIBUTE_VISIBILITY.
	* aclocal.m4: Regenerate.
	* configure: Likewise.
	* configure.ac: Use GCC_CHECK_ATTRIBUTE_VISIBILITY instead of
	LIGOMP_CHECK_ATTRIBUTE_VISIBILITY.
	* testsuite/Makefile.in: Regenerate.

libitm/ChangeLog:

	* Makefile.in: Regenerate.
	* acinclude.m4: Delete LIBITM_CHECK_ATTRIBUTE_VISIBILITY.
	* aclocal.m4: Regenerate.
	* configure: Likewise.
	* configure.ac: Use GCC_CHECK_ATTRIBUTE_VISIBILITY instead of
	LIBITM_CHECK_ATTRIBUTE_VISIBILITY.
	* testsuite/Makefile.in: Regenerate.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
This commit is contained in:
Pietro Monteiro
2025-12-29 21:57:01 -05:00
parent 4a641781ce
commit 9127d1c42f
24 changed files with 53 additions and 88 deletions

14
config/visibility.m4 Normal file
View File

@@ -0,0 +1,14 @@
dnl Check whether the target supports hidden visibility.
AC_DEFUN([GCC_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
gcc_cv_have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void __attribute__((visibility("hidden"))) foo(void) { }]], [])],
gcc_cv_have_attribute_visibility=yes,
gcc_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $gcc_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])

View File

@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../config/warnings.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \

View File

@@ -206,21 +206,6 @@ AC_DEFUN([LIBAT_CHECK_IFUNC], [
dnl ----------------------------------------------------------------------
dnl This whole bit snagged from libitm.
dnl Check whether the target supports hidden visibility.
AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
libat_cv_have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
[], libat_cv_have_attribute_visibility=yes,
libat_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $libat_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
dnl Check whether the target supports dllexport
AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_DLLEXPORT], [
AC_CACHE_CHECK([whether the target supports dllexport],

View File

@@ -1198,6 +1198,7 @@ m4_include([../config/multi.m4])
m4_include([../config/override.m4])
m4_include([../config/stdint.m4])
m4_include([../config/toolexeclibdir.m4])
m4_include([../config/visibility.m4])
m4_include([../config/warnings.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])

12
libatomic/configure vendored
View File

@@ -15435,7 +15435,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
$as_echo_n "checking whether the target supports hidden visibility... " >&6; }
if ${libat_cv_have_attribute_visibility+:} false; then :
if ${gcc_cv_have_attribute_visibility+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -15453,16 +15453,16 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libat_cv_have_attribute_visibility=yes
gcc_cv_have_attribute_visibility=yes
else
libat_cv_have_attribute_visibility=no
gcc_cv_have_attribute_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libat_cv_have_attribute_visibility" >&5
$as_echo "$libat_cv_have_attribute_visibility" >&6; }
if test $libat_cv_have_attribute_visibility = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_visibility" >&5
$as_echo "$gcc_cv_have_attribute_visibility" >&6; }
if test $gcc_cv_have_attribute_visibility = yes; then
$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h

View File

@@ -256,7 +256,7 @@ case " $config_path " in
esac
# See what sort of export controls are available.
LIBAT_CHECK_ATTRIBUTE_VISIBILITY
GCC_CHECK_ATTRIBUTE_VISIBILITY
LIBAT_CHECK_ATTRIBUTE_DLLEXPORT
LIBAT_CHECK_ATTRIBUTE_ALIAS
if test x$try_ifunc = xyes; then

View File

@@ -101,6 +101,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../config/warnings.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \

View File

@@ -171,6 +171,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/ax_pthread.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/acx.m4 \

View File

@@ -31,21 +31,6 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN])
AC_DEFUN([AC_PROG_LD])
])
dnl Check whether the target supports hidden visibility.
AC_DEFUN([LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
libgfor_cv_have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void __attribute__((visibility("hidden"))) foo(void) { }]], [])],
libgfor_cv_have_attribute_visibility=yes,
libgfor_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $libgfor_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
dnl Check whether the target supports symbol aliases.
AC_DEFUN([LIBGFOR_CHECK_ATTRIBUTE_ALIAS], [
AC_CACHE_CHECK([whether the target supports symbol aliases],

View File

@@ -1178,6 +1178,7 @@ m4_include([../config/multi.m4])
m4_include([../config/override.m4])
m4_include([../config/stdint.m4])
m4_include([../config/toolexeclibdir.m4])
m4_include([../config/visibility.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])

12
libgfortran/configure vendored
View File

@@ -32021,7 +32021,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
$as_echo_n "checking whether the target supports hidden visibility... " >&6; }
if ${libgfor_cv_have_attribute_visibility+:} false; then :
if ${gcc_cv_have_attribute_visibility+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -32039,16 +32039,16 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libgfor_cv_have_attribute_visibility=yes
gcc_cv_have_attribute_visibility=yes
else
libgfor_cv_have_attribute_visibility=no
gcc_cv_have_attribute_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_attribute_visibility" >&5
$as_echo "$libgfor_cv_have_attribute_visibility" >&6; }
if test $libgfor_cv_have_attribute_visibility = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_visibility" >&5
$as_echo "$gcc_cv_have_attribute_visibility" >&6; }
if test $gcc_cv_have_attribute_visibility = yes; then
$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h

View File

@@ -787,7 +787,7 @@ fi
# Check out attribute support.
LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
GCC_CHECK_ATTRIBUTE_VISIBILITY
LIBGFOR_CHECK_ATTRIBUTE_ALIAS
# Check out atomic builtins support.

View File

@@ -136,6 +136,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \

View File

@@ -12,21 +12,6 @@ AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
[Define to 1 if the target supports __sync_*_compare_and_swap])
fi])
dnl Check whether the target supports hidden visibility.
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
libgomp_cv_have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
[], libgomp_cv_have_attribute_visibility=yes,
libgomp_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $libgomp_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
dnl Check whether the target supports dllexport
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
AC_CACHE_CHECK([whether the target supports dllexport],

1
libgomp/aclocal.m4 vendored
View File

@@ -1180,6 +1180,7 @@ m4_include([../config/multi.m4])
m4_include([../config/override.m4])
m4_include([../config/tls.m4])
m4_include([../config/toolexeclibdir.m4])
m4_include([../config/visibility.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])

12
libgomp/configure vendored
View File

@@ -16319,7 +16319,7 @@ $as_echo "#define USE_EMUTLS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
$as_echo_n "checking whether the target supports hidden visibility... " >&6; }
if ${libgomp_cv_have_attribute_visibility+:} false; then :
if ${gcc_cv_have_attribute_visibility+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -16337,16 +16337,16 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libgomp_cv_have_attribute_visibility=yes
gcc_cv_have_attribute_visibility=yes
else
libgomp_cv_have_attribute_visibility=no
gcc_cv_have_attribute_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgomp_cv_have_attribute_visibility" >&5
$as_echo "$libgomp_cv_have_attribute_visibility" >&6; }
if test $libgomp_cv_have_attribute_visibility = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_visibility" >&5
$as_echo "$gcc_cv_have_attribute_visibility" >&6; }
if test $gcc_cv_have_attribute_visibility = yes; then
$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h

View File

@@ -325,7 +325,7 @@ GCC_CHECK_TLS
GCC_CHECK_EMUTLS
# See what sort of export controls are available.
LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY
GCC_CHECK_ATTRIBUTE_VISIBILITY
LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT
LIBGOMP_CHECK_ATTRIBUTE_ALIAS
LIBGOMP_ENABLE_SYMVERS

View File

@@ -103,6 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \

View File

@@ -110,6 +110,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../config/weakref.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \

View File

@@ -26,21 +26,6 @@ AC_DEFUN([LIBITM_CHECK_64BIT_SYNC_BUILTINS], [
[Define to 1 if the target supports 64-bit __sync_*_compare_and_swap])
fi])
dnl Check whether the target supports hidden visibility.
AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
libitm_cv_have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
[], libitm_cv_have_attribute_visibility=yes,
libitm_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $libitm_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
dnl Check whether the target supports dllexport
AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_DLLEXPORT], [
AC_CACHE_CHECK([whether the target supports dllexport],

1
libitm/aclocal.m4 vendored
View File

@@ -1202,6 +1202,7 @@ m4_include([../config/override.m4])
m4_include([../config/stdint.m4])
m4_include([../config/tls.m4])
m4_include([../config/toolexeclibdir.m4])
m4_include([../config/visibility.m4])
m4_include([../config/weakref.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])

12
libitm/configure vendored
View File

@@ -17324,7 +17324,7 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
$as_echo_n "checking whether the target supports hidden visibility... " >&6; }
if ${libitm_cv_have_attribute_visibility+:} false; then :
if ${gcc_cv_have_attribute_visibility+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -17342,16 +17342,16 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libitm_cv_have_attribute_visibility=yes
gcc_cv_have_attribute_visibility=yes
else
libitm_cv_have_attribute_visibility=no
gcc_cv_have_attribute_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_have_attribute_visibility" >&5
$as_echo "$libitm_cv_have_attribute_visibility" >&6; }
if test $libitm_cv_have_attribute_visibility = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_visibility" >&5
$as_echo "$gcc_cv_have_attribute_visibility" >&6; }
if test $gcc_cv_have_attribute_visibility = yes; then
$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h

View File

@@ -218,7 +218,7 @@ GCC_LINUX_FUTEX(:)
GCC_CHECK_TLS
# See what sort of export controls are available.
LIBITM_CHECK_ATTRIBUTE_VISIBILITY
GCC_CHECK_ATTRIBUTE_VISIBILITY
LIBITM_CHECK_ATTRIBUTE_DLLEXPORT
LIBITM_CHECK_ATTRIBUTE_ALIAS

View File

@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/toolexeclibdir.m4 \
$(top_srcdir)/../config/visibility.m4 \
$(top_srcdir)/../config/weakref.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \