diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/cares-compilers.m4 | 179 | ||||
-rw-r--r-- | m4/cares-confopts.m4 | 104 |
2 files changed, 138 insertions, 145 deletions
diff --git a/m4/cares-compilers.m4 b/m4/cares-compilers.m4 index a8f1cd5..68f47ef 100644 --- a/m4/cares-compilers.m4 +++ b/m4/cares-compilers.m4 @@ -16,7 +16,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 60 +# serial 61 dnl CARES_CHECK_COMPILER @@ -1249,98 +1249,6 @@ AC_DEFUN([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [ ]) -dnl CARES_CHECK_COMPILER_HIDDEN_SYMBOLS -dnl ------------------------------------------------- -dnl Verify if compiler supports hiding library internal symbols, setting -dnl shell variable hidden_symbols_supported value as appropriate, as well as -dnl variables hidden_symbols_CFLAGS and hidden_symbols_extern when supported. - -AC_DEFUN([CARES_CHECK_COMPILER_HIDDEN_SYMBOLS], [ - AC_REQUIRE([CARES_CHECK_COMPILER])dnl - AC_BEFORE([$0],[CARES_CONFIGURE_HIDDEN_SYMBOLS])dnl - AC_MSG_CHECKING([if compiler supports hiding library internal symbols]) - hidden_symbols_supported="no" - hidden_symbols_CFLAGS="" - hidden_symbols_extern="" - tmp_CFLAGS="" - tmp_extern="" - case "$compiler_id" in - GNU_C) - dnl Only gcc 3.4 or later - if test "$compiler_num" -ge "304"; then - if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then - tmp_extern="__attribute__ ((visibility (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - hidden_symbols_supported="yes" - echo " " >&6 - echo "debug: should work with this compiler and version" >&6 - echo " " >&6 - fi - fi - ;; - INTEL_UNIX_C) - dnl Only icc 9.0 or later - if test "$compiler_num" -ge "900"; then - if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then - tmp_extern="__attribute__ ((visibility (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - hidden_symbols_supported="yes" - echo " " >&6 - echo "debug: should work with this compiler and version" >&6 - echo " " >&6 - fi - fi - ;; - SUNPRO_C) - if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then - tmp_extern="__global" - tmp_CFLAGS="-xldscope=hidden" - hidden_symbols_supported="yes" - echo " " >&6 - echo "debug: should work with this compiler and version" >&6 - echo " " >&6 - fi - ;; - esac - if test "$hidden_symbols_supported" = "yes"; then - tmp_save_CFLAGS="$CFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CFLAGS - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $tmp_extern char *dummy(char *buff); - char *dummy(char *buff) - { - if(buff) - return ++buff; - else - return buff; - } - ]],[[ - char b[16]; - char *r = dummy(&b); - if(r) - return (int)*r; - ]]) - ],[ - hidden_symbols_supported="yes" - ],[ - hidden_symbols_supported="no" - sed 's/^/cc-src: /' conftest.$ac_ext >&6 - sed 's/^/cc-err: /' conftest.err >&6 - ]) - CFLAGS="$tmp_save_CFLAGS" - fi - if test "$hidden_symbols_supported" = "yes"; then - AC_MSG_RESULT([yes]) - hidden_symbols_CFLAGS="$tmp_CFLAGS" - hidden_symbols_extern="$tmp_extern" - else - AC_MSG_RESULT([no]) - fi -]) - - dnl CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE dnl ------------------------------------------------- dnl Verifies if the compiler is capable of handling the @@ -1403,6 +1311,91 @@ AC_DEFUN([CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [ ]) +dnl CARES_CHECK_COMPILER_SYMBOL_HIDING +dnl ------------------------------------------------- +dnl Verify if compiler supports hiding library internal symbols, setting +dnl shell variable supports_symbol_hiding value as appropriate, as well as +dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported. + +AC_DEFUN([CARES_CHECK_COMPILER_SYMBOL_HIDING], [ + AC_REQUIRE([CARES_CHECK_COMPILER])dnl + AC_BEFORE([$0],[CARES_CONFIGURE_SYMBOL_HIDING])dnl + AC_MSG_CHECKING([if compiler supports hiding library internal symbols]) + supports_symbol_hiding="no" + symbol_hiding_CFLAGS="" + symbol_hiding_EXTERN="" + tmp_CFLAGS="" + tmp_EXTERN="" + case "$compiler_id" in + GNU_C) + dnl Only gcc 3.4 or later + if test "$compiler_num" -ge "304"; then + if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then + tmp_EXTERN="__attribute__ ((visibility (\"default\")))" + tmp_CFLAGS="-fvisibility=hidden" + supports_symbol_hiding="yes" + fi + fi + ;; + INTEL_UNIX_C) + dnl Only icc 9.0 or later + if test "$compiler_num" -ge "900"; then + if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then + tmp_EXTERN="__attribute__ ((visibility (\"default\")))" + tmp_CFLAGS="-fvisibility=hidden" + supports_symbol_hiding="yes" + fi + fi + ;; + SUNPRO_C) + if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then + tmp_EXTERN="__global" + tmp_CFLAGS="-xldscope=hidden" + supports_symbol_hiding="yes" + fi + ;; + esac + if test "$supports_symbol_hiding" = "yes"; then + tmp_save_CFLAGS="$CFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CFLAGS + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $tmp_EXTERN char *dummy(char *buff); + char *dummy(char *buff) + { + if(buff) + return ++buff; + else + return buff; + } + ]],[[ + char b[16]; + char *r = dummy(&b); + if(r) + return (int)*r; + ]]) + ],[ + supports_symbol_hiding="yes" + ],[ + supports_symbol_hiding="no" + echo " " >&6 + sed 's/^/cc-src: /' conftest.$ac_ext >&6 + sed 's/^/cc-err: /' conftest.err >&6 + echo " " >&6 + ]) + CFLAGS="$tmp_save_CFLAGS" + fi + if test "$supports_symbol_hiding" = "yes"; then + AC_MSG_RESULT([yes]) + symbol_hiding_CFLAGS="$tmp_CFLAGS" + symbol_hiding_EXTERN="$tmp_EXTERN" + else + AC_MSG_RESULT([no]) + fi +]) + + dnl CARES_VAR_MATCH (VARNAME, VALUE) dnl ------------------------------------------------- dnl Verifies if shell variable VARNAME contains VALUE. diff --git a/m4/cares-confopts.m4 b/m4/cares-confopts.m4 index 241bb49..438f9cd 100644 --- a/m4/cares-confopts.m4 +++ b/m4/cares-confopts.m4 @@ -16,7 +16,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 7 +# serial 8 dnl CARES_CHECK_OPTION_CURLDEBUG @@ -92,46 +92,6 @@ 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 @@ -220,6 +180,46 @@ AC_HELP_STRING([--disable-optimize],[Disable compiler optimizations]), ]) +dnl CARES_CHECK_OPTION_SYMBOL_HIDING +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-symbol-hiding or --disable-symbol-hiding, +dnl setting shell variable want_symbol_hiding value. + +AC_DEFUN([CARES_CHECK_OPTION_SYMBOL_HIDING], [ + AC_BEFORE([$0],[CARES_CHECK_COMPILER_SYMBOL_HIDING])dnl + AC_MSG_CHECKING([whether to enable hiding of library internal symbols]) + OPT_SYMBOL_HIDING="default" + AC_ARG_ENABLE(symbol-hiding, +AC_HELP_STRING([--enable-symbol-hiding],[Enable hiding of library internal symbols]) +AC_HELP_STRING([--disable-symbol-hiding],[Disable hiding of library internal symbols]), + OPT_SYMBOL_HIDING=$enableval) + case "$OPT_SYMBOL_HIDING" in + no) + dnl --disable-symbol-hiding 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_symbol_hiding="no" + AC_MSG_RESULT([no]) + ;; + default) + dnl configure's symbol-hiding option not specified. + dnl Handle this as if --enable-symbol-hiding option was given. + want_symbol_hiding="yes" + AC_MSG_RESULT([yes]) + ;; + *) + dnl --enable-symbol-hiding option used. + dnl This is an indication to attempt hiding of library internal + dnl symbols. This is only supported on some compilers/linkers. + want_symbol_hiding="yes" + AC_MSG_RESULT([yes]) + ;; + esac +]) + + dnl CARES_CHECK_OPTION_WARNINGS dnl ------------------------------------------------- dnl Verify if configure has been invoked with option @@ -293,24 +293,24 @@ AC_DEFUN([CARES_CHECK_NONBLOCKING_SOCKET], [ ]) -dnl CARES_CONFIGURE_HIDDEN_SYMBOLS +dnl CARES_CONFIGURE_SYMBOL_HIDING dnl ------------------------------------------------- -dnl Depending on --enable-hidden-symbols or --disable-hidden-symbols +dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding dnl configure option, and compiler capability to actually honor such -dnl option, compiler flags will be modified as appropriate. +dnl option, this will modify compiler flags as appropriate and also +dnl provide needed definitions for configuration file. 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]) +AC_DEFUN([CARES_CONFIGURE_SYMBOL_HIDING], [ + AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen]) if test x"$ac_cv_native_windows" != "xyes" && - test "$want_hidden_symbols" = "yes" && - test "$hidden_symbols_supported" = "yes"; then - tmp_save_CFLAGS="$CFLAGS" - CFLAGS="$tmp_save_CFLAGS $hidden_symbols_CFLAGS" - AC_DEFINE_UNQUOTED(CARES_HIDDEN_SYMBOLS, 1, + test "$want_symbol_hiding" = "yes" && + test "$supports_symbol_hiding" = "yes"; then + CFLAGS="$CFLAGS $symbol_hiding_CFLAGS" + AC_DEFINE_UNQUOTED(CARES_SYMBOL_HIDING, 1, [Define to 1 to enable hiding of library internal symbols.]) - AC_DEFINE_UNQUOTED(CARES_EXTERN_SYMBOL, $hidden_symbols_extern, + AC_DEFINE_UNQUOTED(CARES_SYMBOL_SCOPE_EXTERN, $symbol_hiding_EXTERN, [Definition to make a library symbol externally visible.]) AC_MSG_RESULT([yes]) else |