diff options
author | Balint Reczey <balint.reczey@ericsson.com> | 2010-12-16 16:42:34 +0000 |
---|---|---|
committer | Balint Reczey <balint.reczey@ericsson.com> | 2010-12-16 16:42:34 +0000 |
commit | 7f690fd0864e22d2907a0581bcdb382b47e8d97b (patch) | |
tree | 316ee3c9771892f73f9dbc15c4b148cdec014cb4 | |
parent | 84aebe5af7dd2a40ef84af3375cd2ec0b169ef6c (diff) |
Export only defined symbols from libwsutil.
Exported symbols are the symbols listed in libwsutil.def, but the
symbols defined in not used optional objects are filtered out.
svn path=/trunk/; revision=35202
-rw-r--r-- | Makefile.am.inc | 2 | ||||
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | wsutil/Makefile.am | 71 |
3 files changed, 66 insertions, 14 deletions
diff --git a/Makefile.am.inc b/Makefile.am.inc index 7af01b3161..91ea02631a 100644 --- a/Makefile.am.inc +++ b/Makefile.am.inc @@ -25,4 +25,4 @@ $(RUNLEX) "$(LEX)" -o$@ $< .def.sym: - $(AWK) '/^EXPORTS$$/ {next;}; /^[^;]/ { print $$1;}' < $< > $@ + $(AWK) '/^EXPORTS$$/ {next;}; ${def_sym_filter_symbols} /^[^;]/ { print $$1;}' < $< > $@ diff --git a/configure.in b/configure.in index 27de1d7ab4..e242ab3af6 100644 --- a/configure.in +++ b/configure.in @@ -1591,6 +1591,7 @@ AC_CHECK_FUNC(getopt, if test "$ac_cv_func_getopt" = no ; then GETOPT_LO="wsgetopt.lo" fi +AM_CONDITIONAL(NEED_GETOPT_LO, test "x$ac_cv_func_getopt" = "xno") AC_SUBST(GETOPT_LO) AC_CHECK_FUNC(strerror, STRERROR_LO="", @@ -1600,6 +1601,7 @@ AC_CHECK_FUNC(strerror, STRERROR_LO="", if test "$ac_cv_func_strerror" = no ; then STRERROR_LO="strerror.lo" fi +AM_CONDITIONAL(NEED_STRERROR_LO, test "x$ac_cv_func_strerror" = "xno") AC_SUBST(STRERROR_LO) AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="", @@ -1607,6 +1609,7 @@ AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="", if test "$ac_cv_func_strncasecmp" = no ; then STRNCASECMP_LO="strncasecmp.lo" fi +AM_CONDITIONAL(NEED_STRNCASECMP_LO, test "x$ac_cv_func_strncasecmp" = "xno") AC_SUBST(STRNCASECMP_LO) AC_CHECK_FUNCS(mkstemp mkdtemp) @@ -1619,6 +1622,7 @@ if test "$have_inet_aton" = no; then else INET_ATON_LO="" fi +AM_CONDITIONAL(NEED_INET_ATON_LO, test "x$have_inet_aton" = "xno") AC_SUBST(INET_ATON_LO) AC_SEARCH_LIBS(inet_pton, [socket nsl], [ @@ -1647,6 +1651,7 @@ if test "$have_inet_pton" = no; then else INET_PTON_LO="" fi +AM_CONDITIONAL(NEED_INET_PTON_LO, test "x$have_inet_pton" = "xno") AC_SUBST(INET_PTON_LO) AC_SEARCH_LIBS(inet_ntop, [socket nsl], [ @@ -1676,6 +1681,7 @@ extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [ INET_NTOP_LO="inet_ntop.lo" AC_DEFINE(NEED_INET_V6DEFS_H, 1, [Define if inet/v6defs.h needs to be included])]) +AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x") AC_SUBST(INET_NTOP_LO) AC_CHECK_FUNC(strptime, STRPTIME_LO="", @@ -1686,6 +1692,7 @@ if test "$ac_cv_func_strptime" = no ; then STRPTIME_LO="strptime.lo" fi AC_SUBST(STRPTIME_C) +AM_CONDITIONAL(NEED_STRPTIME_LO, test "x$ac_cv_func_strptime" = "no") AC_SUBST(STRPTIME_LO) AC_CHECK_FUNCS(getprotobynumber gethostbyname2) diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am index 9b00cee8d4..ab60a63d9c 100644 --- a/wsutil/Makefile.am +++ b/wsutil/Makefile.am @@ -22,25 +22,68 @@ ACLOCAL_AMFLAGS = `../aclocal-flags` +# Optional objects that I know how to build. These will be +# linked into libwsutil. +wsutil_optional_objects = + +# filters for symbols to be omitted from libwsutil.sym +# symbols defined only on windows +def_sym_filter_symbols = /^getenv_utf8/ || /^ws_stdio/ || /^ws_init_dll_search_path/ || /^ws_load_library/ || /^ws_module_open/ + +if NEED_GETOPT_LO +wsutil_optional_objects += @GETOPT_LO@ +else +def_sym_filter_symbols += || /^getopt/ || /^optarg/ || /^optind/ || /^opterr/ || /^optopt/ +endif + +if NEED_INET_ATON_LO +wsutil_optional_objects += @INET_ATON_LO@ +else +def_sym_filter_symbols += || /^inet_aton/ +endif + +if NEED_INET_NTOP_LO +wsutil_optional_objects += @INET_NTOP_LO@ +else +def_sym_filter_symbols += || /^ws_inet_ntop/ +endif + +if NEED_INET_PTON_LO +wsutil_optional_objects += @INET_PTON_LO@ +else +def_sym_filter_symbols += || /^ws_inet_pton/ +endif + +if NEED_STRERROR_LO +wsutil_optional_objects += @STRERROR_LO@ +else +def_sym_filter_symbols += || /^strerror/ +endif + +if NEED_STRNCASECMP_LO +wsutil_optional_objects += @STRNCASECMP_LO@ +else +def_sym_filter_symbols += || /^strncasecmp/ +endif + +if NEED_STRPTIME_LO +wsutil_optional_objects += @STRPTIME_LO@ +else +def_sym_filter_symbols += || /^strptime/ +endif + +def_sym_filter_symbols += {next;}; + +include ../Makefile.am.inc + include Makefile.common if HAVE_WARNINGS_AS_ERRORS AM_CFLAGS = -Werror endif -# Optional objects that I know how to build. These will be -# linked into libwsutil. -wsutil_optional_objects = \ - @GETOPT_LO@ \ - @INET_ATON_LO@ \ - @INET_NTOP_LO@ \ - @INET_PTON_LO@ \ - @STRERROR_LO@ \ - @STRNCASECMP_LO@ \ - @STRPTIME_LO@ - lib_LTLIBRARIES = libwsutil.la -libwsutil_la_LDFLAGS = -version-info 0:0:0 @LDFLAGS_SHAREDLIB@ +libwsutil_la_LDFLAGS = -version-info 0:0:0 -export-symbols libwsutil.sym @LDFLAGS_SHAREDLIB@ INCLUDES = -I$(srcdir)/.. @@ -63,7 +106,8 @@ EXTRA_libwsutil_la_SOURCES= \ wsgetopt.h libwsutil_la_DEPENDENCIES= \ - $(wsutil_optional_objects) + $(wsutil_optional_objects) \ + libwsutil.sym libwsutil_la_LIBADD = \ @GLIB_LIBS@ \ @@ -81,6 +125,7 @@ EXTRA_DIST = \ CLEANFILES = \ libwsutil.a \ libwsutil.la \ + libwsutil.sym \ *~ MAINTAINERCLEANFILES = \ |