pcre/pcre-visibility.patch

59 lines
9.3 KiB
Diff
Raw Normal View History

--- configure.ac.orig
+++ configure.ac
@@ -672,6 +672,44 @@ if test "$enable_pcretest_libreadline" =
fi
AC_SUBST(LIBREADLINE)
+
+ dnl ************************************************************
+ dnl Enable hiding of internal symbols in library to reduce its size and
+ dnl speed dynamic linking of applications. This currently is only supported
+ dnl on gcc >= 4.0 and SunPro C.
+ dnl
+ AC_MSG_CHECKING([whether to enable hidden symbols in the library])
+ AC_ARG_ENABLE(hidden-symbols,
+ AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
+ AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
+ [ case "$enableval" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_CHECKING([whether $CC supports it])
+ if test "$GCC" = yes ; then
+ if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PCRE_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRE_EXP_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRE_EXP_DATA_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCREPOSIX_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCREPOSIX_EXP_DEFN, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRECPP_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRECPP_EXP_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ CXXFLAGS="$CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ fi
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ )
+
# Produce these files, in addition to config.h.
AC_CONFIG_FILES(
Makefile
--- Makefile.am.orig
+++ Makefile.am
@@ -252,7 +252,7 @@ TESTS += RunGrepTest
dist_noinst_SCRIPTS += RunGrepTest
bin_PROGRAMS += pcregrep
pcregrep_SOURCES = pcregrep.c
-pcregrep_LDADD = libpcreposix.la $(LIBZ) $(LIBBZ2)
+pcregrep_LDADD = libpcreposix.la libpcre.la $(LIBZ) $(LIBBZ2)
EXTRA_DIST += \
testdata/grepinput \