From 0d9f14f5c17e4a3888dedbc8d568a55979fc05f0 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 28 Oct 2009 19:45:26 +0000 Subject: Initial step towards the ability to reduce c-ares exported symbols based on the 'visibility' attribute for GNUC and __global for Sun compilers, taking also in account __declspec function decoration for Win32 and Symbian DLL's. Introducing configure options --enable-hidden-symbols and --disable-hidden-symbols following libcurl's naming. --- ares/m4/cares-confopts.m4 | 63 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 'ares/m4/cares-confopts.m4') diff --git a/ares/m4/cares-confopts.m4 b/ares/m4/cares-confopts.m4 index cc03a09d6..5af3232ad 100644 --- a/ares/m4/cares-confopts.m4 +++ b/ares/m4/cares-confopts.m4 @@ -16,7 +16,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 5 +# serial 6 dnl CARES_CHECK_OPTION_CURLDEBUG @@ -92,6 +92,46 @@ AC_HELP_STRING([--disable-debug],[Disable debug build options]), ]) +dnl CARES_CHECK_OPTION_HIDDEN_SYMBOLS +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-hidden-symbols or --disable-hidden-symbols, +dnl setting shell variable want_hidden_symbols value. + +AC_DEFUN([CARES_CHECK_OPTION_HIDDEN_SYMBOLS], [ + AC_BEFORE([$0],[CARES_CHECK_COMPILER_HIDDEN_SYMBOLS])dnl + AC_MSG_CHECKING([whether to enable hiding symbols]) + OPT_HIDDEN_SYMBOLS="default" + AC_ARG_ENABLE(hidden-symbols, +AC_HELP_STRING([--enable-hidden-symbols],[Enable hiding of library internal symbols]) +AC_HELP_STRING([--disable-hidden-symbols],[Disable hiding of library internal symbols]), + OPT_HIDDEN_SYMBOLS=$enableval) + case "$OPT_HIDDEN_SYMBOLS" in + no) + dnl --disable-hidden-symbols option used. + dnl This is an indication to not attempt hiding of library internal + dnl symbols. Default symbol visibility will be used, which normally + dnl exposes all library internal symbols. + want_hidden_symbols="no" + AC_MSG_RESULT([no]) + ;; + default) + dnl configure's hidden-symbols option not specified. + dnl Handle this as if --enable-hidden-symbols option was given. + want_hidden_symbols="yes" + AC_MSG_RESULT([not specified (assuming yes)]) + ;; + *) + dnl --enable-hidden-symbols option used. + dnl This is an indication to attempt hiding of library internal + dnl symbols. This is only supported on some compilers/linkers. + want_hidden_symbols="yes" + AC_MSG_RESULT([yes]) + ;; + esac +]) + + dnl CARES_CHECK_OPTION_NONBLOCKING dnl ------------------------------------------------- dnl Verify if configure has been invoked with option @@ -252,3 +292,24 @@ AC_DEFUN([CARES_CHECK_NONBLOCKING_SOCKET], [ fi ]) + +dnl CARES_CONFIGURE_HIDDEN_SYMBOLS +dnl ------------------------------------------------- +dnl Depending on --enable-hidden-symbols or --disable-hidden-symbols +dnl configure option, and compiler capability to actually honor such +dnl option, compiler flags will be modified as appropriate. +dnl This macro should not be used until all compilation tests have +dnl been done to prevent interferences on other tests. + +AC_DEFUN([CARES_CONFIGURE_HIDDEN_SYMBOLS], [ + AC_MSG_CHECKING([whether to actually hide library internal symbols]) + if test "$want_hidden_symbols" = "yes" && + test "$hidden_symbols_supported" = "yes"; then + tmp_save_CFLAGS="$CFLAGS" + CFLAGS="$tmp_save_CFLAGS $hidden_symbols_CFLAGS" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi +]) + -- cgit v1.2.3