guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. 442f3f20ddd33b43743ea


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. 442f3f20ddd33b43743ea181d95024c10622df52
Date: Tue, 26 May 2009 16:00:40 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=442f3f20ddd33b43743ea181d95024c10622df52

The branch, master has been updated
       via  442f3f20ddd33b43743ea181d95024c10622df52 (commit)
       via  d9a9e18205f4da1486a70dbd5690b8fdc593cb10 (commit)
      from  de784acd87b8d567fb6433d8f531a7f28b91d635 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 442f3f20ddd33b43743ea181d95024c10622df52
Author: Andy Wingo <address@hidden>
Date:   Tue May 26 17:39:58 2009 +0200

    symbols are now hidden unless explicitly exported by SCM_API
    
    * libguile/__scm.h (SCM_API, SCM_INTERNAL): Take the reverse strategy: 
symbols will
      be hidden by default, and only exported with SCM_API. In addition to 
working
      on Mac OS, it has the several nice efficiency benefits on Linux, and 
unifies
      codepaths with Win32.
    
    * libguile/Makefile.am: Define BUILDING_LIBGUILE when building Guile.

commit d9a9e18205f4da1486a70dbd5690b8fdc593cb10
Author: Andy Wingo <address@hidden>
Date:   Tue May 26 17:45:48 2009 +0200

    gnulib-tool --import lib-symbol-visibility

-----------------------------------------------------------------------

Summary of changes:
 lib/Makefile.am      |   12 ++++++++++-
 libguile/Makefile.am |    4 +-
 libguile/__scm.h     |   26 +++++++++++-------------
 m4/gnulib-cache.m4   |    3 +-
 m4/gnulib-comp.m4    |    2 +
 m4/include_next.m4   |   32 +++++++++++++++++++++++-------
 m4/visibility.m4     |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 105 insertions(+), 26 deletions(-)
 create mode 100644 m4/visibility.m4

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 78693ea..8f431c2 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl 
--libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits 
extensions flock fpieee full-read full-write putenv stdlib strcase strftime
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl 
--libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits 
extensions flock fpieee full-read full-write lib-symbol-visibility putenv 
stdlib strcase strftime
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -143,6 +143,16 @@ libgnu_la_SOURCES += full-write.h full-write.c
 
 ## end   gnulib module full-write
 
+## begin gnulib module lib-symbol-visibility
+
+# The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
+# compilation of all sources that make up the library. This line here does it
+# only for the gnulib part of it. The developer is responsible for adding
+# $(CFLAG_VISIBILITY) to the Makefile.ams of the other portions of the library.
+AM_CFLAGS += $(CFLAG_VISIBILITY)
+
+## end   gnulib module lib-symbol-visibility
+
 ## begin gnulib module link-warning
 
 LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 369b249..63f2ef2 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -32,10 +32,10 @@ DEFAULT_INCLUDES =
 ## Check for headers in $(srcdir)/.., so that #include
 ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
 ## building.  Also look for Gnulib headers in `lib'.
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)                \
+AM_CPPFLAGS = -DBUILDING_LIBGUILE=1 -I$(top_srcdir) -I$(top_builddir) \
              -I$(top_srcdir)/lib -I$(top_builddir)/lib
 
-AM_CFLAGS = $(GCC_CFLAGS)
+AM_CFLAGS = $(GCC_CFLAGS) $(CFLAG_VISIBILITY)
 
 ## The Gnulib Libtool archive.
 gnulib_library = $(top_builddir)/lib/libgnu.la
diff --git a/libguile/__scm.h b/libguile/__scm.h
index 3672b1c..07d7b4d 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -98,13 +98,10 @@
 #define SCM_UNLIKELY(_expr)  SCM_EXPECT ((_expr), 0)
 
 /* The SCM_INTERNAL macro makes it possible to explicitly declare a function
- * as having "internal" linkage.  */
-#if (defined __GNUC__) && \
-  ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ == 3))
-# define SCM_INTERNAL  extern __attribute__ ((__visibility__ ("internal")))
-#else
-# define SCM_INTERNAL  extern
-#endif
+ * as having "internal" linkage.  However our current tack on this problem is
+ * to use GCC 4's -fvisibility=hidden, making functions internal by default,
+ * and then SCM_API marks them for export. */
+#define SCM_INTERNAL  extern
 
 
 
@@ -154,13 +151,14 @@
 
 
 /* SCM_API is a macro prepended to all function and data definitions
-   which should be exported or imported in the resulting dynamic link
-   library (DLL) in the Win32 port. */
-
-#if defined (SCM_IMPORT)
-# define SCM_API __declspec (dllimport) extern
-#elif defined (SCM_EXPORT) || defined (DLL_EXPORT)
-# define SCM_API __declspec (dllexport) extern
+   which should be exported from libguile. */
+
+#if BUILDING_LIBGUILE && HAVE_VISIBILITY
+# define SCM_API extern __attribute__((__visibility__("default")))
+#elif BUILDING_LIBGUILE && defined _MSC_VER
+# define SCM_API __declspec(dllexport) extern
+#elif defined _MSC_VER
+# define SCM_API __declspec(dllimport) extern
 #else
 # define SCM_API extern
 #endif
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 1122aa5..fd6c4fe 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool 
--macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits extensions 
flock fpieee full-read full-write putenv stdlib strcase strftime
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool 
--macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits extensions 
flock fpieee full-read full-write lib-symbol-visibility putenv stdlib strcase 
strftime
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -28,6 +28,7 @@ gl_MODULES([
   fpieee
   full-read
   full-write
+  lib-symbol-visibility
   putenv
   stdlib
   strcase
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 186f30f..77100fa 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -48,6 +48,7 @@ AC_DEFUN([gl_INIT],
   gl_FUNC_FLOCK
   gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock])
   gl_INLINE
+  gl_VISIBILITY
   gl_LOCALCHARSET
   
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
   AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
@@ -283,6 +284,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/time_r.m4
   m4/tm_gmtoff.m4
   m4/unistd_h.m4
+  m4/visibility.m4
   m4/wchar.m4
   m4/wint_t.m4
   m4/write.m4
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index d6101fe..5e22ded 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 12
+# include_next.m4 serial 14
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -104,8 +104,14 @@ EOF
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# Also, if #include_next works as first preprocessing directive in a file,
+# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
+# be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
 #      address@hidden@ @NEXT_FOO_H@
+# or
+#      address@hidden@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
@@ -123,15 +129,15 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
-                   [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
+                   [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
-        [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
-        m4_quote(m4_defn([gl_next_header])),
+        [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+        m4_defn([gl_next_header]),
         [AS_VAR_PUSHDEF([gl_header_exists],
-                        [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
+                        [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
          if test AS_VAR_GET(gl_header_exists) = yes; then
            AC_LANG_CONFTEST(
              [AC_LANG_SOURCE(
@@ -153,8 +159,8 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
            dnl so use subshell.
            AS_VAR_SET([gl_next_header],
              ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 
2>&AS_MESSAGE_LOG_FD |
-              sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
-                s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
+              sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
+                s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
                 s#^/[^/]#//&#
                 p
                 q
@@ -165,7 +171,17 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
-       AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
+       AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
        [AS_VAR_GET([gl_next_header])])
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = 
buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'gl_HEADER_NAME'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+     fi
+     AC_SUBST(
+       AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
+       [$gl_next_as_first_directive])
      AS_VAR_POPDEF([gl_next_header])])
 ])
diff --git a/m4/visibility.m4 b/m4/visibility.m4
new file mode 100644
index 0000000..70bca56
--- /dev/null
+++ b/m4/visibility.m4
@@ -0,0 +1,52 @@
+# visibility.m4 serial 2 (gettext-0.18)
+dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl Tests whether the compiler supports the command-line option
+dnl -fvisibility=hidden and the function and variable attributes
+dnl __attribute__((__visibility__("hidden"))) and
+dnl __attribute__((__visibility__("default"))).
+dnl Does *not* test for __visibility__("protected") - which has tricky
+dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
+dnl MacOS X.
+dnl Does *not* test for __visibility__("internal") - which has processor
+dnl dependent semantics.
+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
+dnl "really only recommended for legacy code".
+dnl Set the variable CFLAG_VISIBILITY.
+dnl Defines and sets the variable HAVE_VISIBILITY.
+
+AC_DEFUN([gl_VISIBILITY],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  CFLAG_VISIBILITY=
+  HAVE_VISIBILITY=0
+  if test -n "$GCC"; then
+    AC_MSG_CHECKING([for simple visibility declarations])
+    AC_CACHE_VAL([gl_cv_cc_visibility], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -fvisibility=hidden"
+      AC_TRY_COMPILE(
+        [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+         extern __attribute__((__visibility__("default"))) int exportedvar;
+         extern __attribute__((__visibility__("hidden"))) int hiddenfunc 
(void);
+         extern __attribute__((__visibility__("default"))) int exportedfunc 
(void);],
+        [],
+        [gl_cv_cc_visibility=yes],
+        [gl_cv_cc_visibility=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_visibility])
+    if test $gl_cv_cc_visibility = yes; then
+      CFLAG_VISIBILITY="-fvisibility=hidden"
+      HAVE_VISIBILITY=1
+    fi
+  fi
+  AC_SUBST([CFLAG_VISIBILITY])
+  AC_SUBST([HAVE_VISIBILITY])
+  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
+    [Define to 1 or 0, depending whether the compiler supports simple 
visibility declarations.])
+])


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]