ares.h: stricter CARES_EXTERN linkage decorations logic
No API change involved.
This commit is contained in:
parent
8f3f059f33
commit
127d4cb357
28
Makefile.am
28
Makefile.am
|
@ -114,29 +114,23 @@ libcares_la_LDFLAGS = $(AM_LDFLAGS) $(libcares_la_LDFLAGS_EXTRA)
|
|||
# Add -Werror if defined
|
||||
CFLAGS += @CARES_CFLAG_EXTRAS@
|
||||
|
||||
CFLAG_CARES_SYMBOL_HIDING = @CFLAG_CARES_SYMBOL_HIDING@
|
||||
|
||||
# For Windows build targets, when building or using static c-ares
|
||||
if USE_CPPFLAG_CARES_STATICLIB
|
||||
AM_CPPFLAGS += -DCARES_STATICLIB
|
||||
AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB)
|
||||
endif
|
||||
|
||||
libcares_la_CFLAGS_EXTRA =
|
||||
|
||||
libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY
|
||||
|
||||
if DOING_CARES_SYMBOL_HIDING
|
||||
if USE_CPPFLAG_CARES_BUILDING_LIBRARY
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_SYMBOL_HIDING -DCARES_BUILDING_LIBRARY
|
||||
else
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_SYMBOL_HIDING
|
||||
endif
|
||||
libcares_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_CARES_SYMBOL_HIDING)
|
||||
else
|
||||
if USE_CPPFLAG_CARES_BUILDING_LIBRARY
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_BUILDING_LIBRARY
|
||||
else
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
endif
|
||||
libcares_la_CFLAGS = $(AM_CFLAGS)
|
||||
libcares_la_CFLAGS_EXTRA += $(CFLAG_CARES_SYMBOL_HIDING)
|
||||
libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING
|
||||
endif
|
||||
|
||||
libcares_la_CFLAGS = $(AM_CFLAGS) $(libcares_la_CFLAGS_EXTRA)
|
||||
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcares_la_CPPFLAGS_EXTRA)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
|
|
16
ares.h
16
ares.h
|
@ -75,22 +75,18 @@ extern "C" {
|
|||
** c-ares external API function linkage decorations.
|
||||
*/
|
||||
|
||||
#if !defined(CARES_STATICLIB) && \
|
||||
(defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
|
||||
/* __declspec function decoration for Win32 and Symbian DLL's */
|
||||
#ifdef CARES_STATICLIB
|
||||
# define CARES_EXTERN
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
|
||||
# if defined(CARES_BUILDING_LIBRARY)
|
||||
# define CARES_EXTERN __declspec(dllexport)
|
||||
# else
|
||||
# define CARES_EXTERN __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(CARES_BUILDING_LIBRARY) && defined(CARES_SYMBOL_HIDING)
|
||||
# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
|
||||
#else
|
||||
/* visibility function decoration for other cases */
|
||||
# if !defined(CARES_SYMBOL_HIDING) || \
|
||||
defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
|
||||
# define CARES_EXTERN
|
||||
# else
|
||||
# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
|
||||
# endif
|
||||
# define CARES_EXTERN
|
||||
#endif
|
||||
|
||||
|
||||
|
|
54
configure.ac
54
configure.ac
|
@ -110,32 +110,36 @@ AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED],
|
|||
AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT],
|
||||
[test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
|
||||
|
||||
#
|
||||
# Due to libtool and automake machinery limitations of not allowing
|
||||
# specifying separate CPPFLAGS or CFLAGS when compiling objects for
|
||||
# inclusion of these in shared or static libraries, we are forced to
|
||||
# build using separate configure runs for shared and static libraries
|
||||
# on systems where different CPPFLAGS or CFLAGS are mandatory in order
|
||||
# to compile objects for each kind of library. Notice that relying on
|
||||
# the '-DPIC' CFLAG that libtool provides is not valid given that the
|
||||
# user might for example choose to build static libraries with PIC.
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([if we need CARES_BUILDING_LIBRARY])
|
||||
use_cppflag_cares_building_library="no"
|
||||
use_cppflag_cares_staticlib="no"
|
||||
CPPFLAG_CARES_STATICLIB=""
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
AC_MSG_RESULT(yes)
|
||||
use_cppflag_cares_building_library="yes"
|
||||
AC_MSG_CHECKING([if we need CARES_STATICLIB])
|
||||
if test "X$enable_shared" = "Xno"
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
use_cppflag_cares_staticlib="yes"
|
||||
CPPFLAG_CARES_STATICLIB="-DCARES_STATICLIB"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(USE_CPPFLAG_CARES_BUILDING_LIBRARY, test x$use_cppflag_cares_building_library = xyes)
|
||||
AM_CONDITIONAL(USE_CPPFLAG_CARES_STATICLIB, test x$use_cppflag_cares_staticlib = xyes)
|
||||
AC_SUBST(CPPFLAG_CARES_STATICLIB)
|
||||
#
|
||||
# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
|
||||
# targeting a static library and not building its shared counterpart.
|
||||
#
|
||||
|
||||
AM_CONDITIONAL([USE_CPPFLAG_CARES_STATICLIB],
|
||||
[test "x$xc_lt_build_static_only" = 'xyes'])
|
||||
|
||||
#
|
||||
# Make staticlib CPPFLAG variable and its definition visible in output
|
||||
# files unconditionally, providing an empty definition unless strictly
|
||||
# targeting a static library and not building its shared counterpart.
|
||||
#
|
||||
|
||||
CPPFLAG_CARES_STATICLIB=
|
||||
if test "x$xc_lt_build_static_only" = 'xyes'; then
|
||||
CPPFLAG_CARES_STATICLIB='-DCARES_STATICLIB'
|
||||
fi
|
||||
AC_SUBST([CPPFLAG_CARES_STATICLIB])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl platform/compiler/architecture specific checks/flags
|
||||
|
|
Loading…
Reference in New Issue