File: cf_visibility.m4

package info (click to toggle)
crossfire 1.75.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,168 kB
  • sloc: ansic: 83,169; sh: 4,659; perl: 1,736; lex: 1,443; makefile: 1,199; python: 43
file content (37 lines) | stat: -rw-r--r-- 782 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Check for -fvisibility and the related __attribute__s

AC_DEFUN([CF_CHECK_VISIBILITY],
[
	AC_MSG_CHECKING([whether the C compiler supports -fvisibility=hidden and the visibility __attribute__])
	saved_CFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
	AC_RUN_IFELSE([AC_LANG_SOURCE([[
__attribute__((visibility("hidden")))
int t1(void)
{
    return 0;
}

__attribute__((visibility("default")))
int t2(void)
{
    return 0;
}

int main(void)
{
    t1();
    t2();
    return 0;
}
		]])],[
			AC_MSG_RESULT([yes])
			AC_DEFINE([HAVE_VISIBILITY], 1, [Define if __attribute__((visibility)) is supported])
			CFLAGS="$saved_CFLAGS -fvisibility=hidden"
		],[
			AC_MSG_RESULT([no])
			CFLAGS="$saved_CFLAGS"
		],[
			AC_MSG_RESULT([skipped because cross compiling])
	])
])