svn commit: samba r13847 - in branches/SAMBA_4_0/source: build/m4
include
jelmer at samba.org
jelmer at samba.org
Sun Mar 5 18:28:33 GMT 2006
Author: jelmer
Date: 2006-03-05 18:28:33 +0000 (Sun, 05 Mar 2006)
New Revision: 13847
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13847
Log:
Fix some portability issues with the visibility attribute.
Modified:
branches/SAMBA_4_0/source/build/m4/check_cc.m4
branches/SAMBA_4_0/source/include/includes.h
Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/check_cc.m4 2006-03-05 18:25:46 UTC (rev 13846)
+++ branches/SAMBA_4_0/source/build/m4/check_cc.m4 2006-03-05 18:28:33 UTC (rev 13847)
@@ -124,14 +124,16 @@
fi
if test -n "$VISIBILITY_CFLAGS"; then
OLD_CFLAGS="${CFLAGS}"
- CFLAGS="${CFLAGS} ${VISIBILITY_CFLAGS} -D_PUBLIC_=__attribute__((visibility(\"default\")))"
- VISIBILITY_CFLAGS="${VISIBILITY_CFLAGS} -D_PUBLIC_=\"__attribute__((visibility(\\\"default\\\")))\""
- AC_MSG_CHECKING([that the C compiler can use the VISIBILITY_CFLAGS])
+ CFLAGS="${CFLAGS} ${VISIBILITY_CFLAGS}"
+ AC_MSG_CHECKING([whether the C compiler supports the visibility attribute])
AC_TRY_RUN([
- _PUBLIC_ void vis_foo1(void) {}
- __attribute__((visibility("default"))) void vis_foo2(void) {}
- #include "${srcdir-.}/build/tests/trivial.c"
- ], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no);VISIBILITY_CFLAGS=""])
+#pragma GCC visibility push(hidden)
+void vis_foo1(void) {}
+__attribute__((visibility("default"))) void vis_foo2(void) {}
+#include "${srcdir-.}/build/tests/trivial.c"
+], [AC_MSG_RESULT(yes);
+AC_DEFINE(HAVE_VISIBILITY_ATTR,1,[Whether the C compiler supports the visibility attribute])],
+[AC_MSG_RESULT(no);VISIBILITY_CFLAGS=""])
CFLAGS="${OLD_CFLAGS}"
fi
Modified: branches/SAMBA_4_0/source/include/includes.h
===================================================================
--- branches/SAMBA_4_0/source/include/includes.h 2006-03-05 18:25:46 UTC (rev 13846)
+++ branches/SAMBA_4_0/source/include/includes.h 2006-03-05 18:28:33 UTC (rev 13847)
@@ -36,6 +36,12 @@
/** Feel free to add definitions for other compilers here. */
#endif
+#ifdef HAVE_VISIBILITY_ATTR
+# define _PUBLIC_ __attribute__((visibility("default")))
+#else
+# define _PUBLIC_
+#endif
+
#ifndef PRINTF_ATTRIBUTE
#if !defined(NO_PRINTF_ATTRIBUTE) && (__GNUC__ >= 3)
/** Use gcc attribute to check printf fns. a1 is the 1-based index of
@@ -158,8 +164,4 @@
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
#endif /* _INCLUDES_H */
More information about the samba-cvs
mailing list