~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/visibility.m4

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# visibility.m4 serial 2 (gettext-0.18)
1
2
dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc.
2
 
dnl Copyright (C) 2009 Monty Taylor
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
20
20
dnl Set the variable CFLAG_VISIBILITY.
21
21
dnl Defines and sets the variable HAVE_VISIBILITY.
22
22
 
23
 
AC_DEFUN([PANDORA_CHECK_VISIBILITY],
 
23
AC_DEFUN([gl_VISIBILITY],
24
24
[
25
25
  AC_REQUIRE([AC_PROG_CC])
26
26
  CFLAG_VISIBILITY=
27
27
  HAVE_VISIBILITY=0
28
 
  AS_IF([test -n "$GCC"],[
 
28
  if test -n "$GCC"; then
29
29
    AC_MSG_CHECKING([for simple visibility declarations])
30
30
    AC_CACHE_VAL([gl_cv_cc_visibility], [
31
31
      gl_save_CFLAGS="$CFLAGS"
32
 
      CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
 
32
      CFLAGS="$CFLAGS -fvisibility=hidden"
33
33
      AC_TRY_COMPILE(
34
34
        [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
35
35
         extern __attribute__((__visibility__("default"))) int exportedvar;
36
36
         extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
37
37
         extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
38
 
        [],[
39
 
        case "$host_os" in
40
 
          *darwin*)
41
 
            gl_cv_cc_visibility=no
42
 
            ;;
43
 
          *)
44
 
            gl_cv_cc_visibility=yes
45
 
            ;;
46
 
        esac
47
 
        ],[gl_cv_cc_visibility=no])
 
38
        [],
 
39
        [gl_cv_cc_visibility=yes],
 
40
        [gl_cv_cc_visibility=no])
48
41
      CFLAGS="$gl_save_CFLAGS"])
49
42
    AC_MSG_RESULT([$gl_cv_cc_visibility])
50
43
    if test $gl_cv_cc_visibility = yes; then
51
44
      CFLAG_VISIBILITY="-fvisibility=hidden"
52
 
      CXXFLAG_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden"
53
 
      NO_VISIBILITY="-fvisibility=default"
54
45
      HAVE_VISIBILITY=1
55
46
    fi
56
 
  ])
57
 
  AS_IF([test "x$SUNCC" = "xyes"],[
58
 
    CFLAG_VISIBILITY="-xldscope=hidden"
59
 
    CXXFLAG_VISIBILITY="-xldscope=hidden"
60
 
    NO_VISIBILITY="-xldscope=global"
61
 
    HAVE_VISIBILITY=1
62
 
  ])
 
47
  fi
63
48
  AC_SUBST([CFLAG_VISIBILITY])
64
 
  AC_SUBST([CXXFLAG_VISIBILITY])
65
 
  AC_SUBST([NO_VISIBILITY])
66
49
  AC_SUBST([HAVE_VISIBILITY])
67
50
  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
68
51
    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
69
52
])
70
 
 
71
 
AC_DEFUN([PANDORA_ENABLE_VISIBILITY],[
72
 
  AC_REQUIRE([PANDORA_CHECK_VISIBILITY])
73
 
  AM_CFLAGS="${AM_CFLAGS} ${CFLAG_VISIBILITY}"
74
 
  AM_CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAG_VISIBILITY}"
75
 
])