mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
curl.h: stricter CURL_EXTERN linkage decorations logic
No API change involved. Info: http://curl.haxx.se/mail/lib-2013-02/0234.html
This commit is contained in:
parent
90d7d1b727
commit
83a42ee20e
59
configure.ac
59
configure.ac
@ -211,32 +211,37 @@ AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
|
||||
AM_CONDITIONAL([CURL_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.
|
||||
#
|
||||
|
||||
#
|
||||
# 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_CURL_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_CURL_STATICLIB=
|
||||
if test "x$xc_lt_build_static_only" = 'xyes'; then
|
||||
CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
|
||||
fi
|
||||
AC_SUBST([CPPFLAG_CURL_STATICLIB])
|
||||
|
||||
AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
|
||||
use_cppflag_building_libcurl="no"
|
||||
use_cppflag_curl_staticlib="no"
|
||||
CPPFLAG_CURL_STATICLIB=""
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
AC_MSG_RESULT(yes)
|
||||
use_cppflag_building_libcurl="yes"
|
||||
AC_MSG_CHECKING([if we need CURL_STATICLIB])
|
||||
if test "X$enable_shared" = "Xno"
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
use_cppflag_curl_staticlib="yes"
|
||||
CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(USE_CPPFLAG_BUILDING_LIBCURL, test x$use_cppflag_building_libcurl = xyes)
|
||||
AM_CONDITIONAL(USE_CPPFLAG_CURL_STATICLIB, test x$use_cppflag_curl_staticlib = xyes)
|
||||
AC_SUBST(CPPFLAG_CURL_STATICLIB)
|
||||
|
||||
# Determine whether all dependent libraries must be specified when linking
|
||||
if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
|
||||
@ -248,10 +253,6 @@ fi
|
||||
AC_SUBST(REQUIRE_LIB_DEPS)
|
||||
AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
|
||||
|
||||
dnl The install stuff has already been taken care of by the automake stuff
|
||||
dnl AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl check if there's a way to force code inline
|
||||
AC_C_INLINE
|
||||
|
||||
|
@ -43,7 +43,6 @@ LIBDIR = $(top_builddir)/lib
|
||||
# Avoid libcurl obsolete stuff
|
||||
AM_CPPFLAGS += -DCURL_NO_OLDIES
|
||||
|
||||
# Mostly for Windows build targets, when using static libcurl
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
|
@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -93,29 +93,21 @@ extern "C" {
|
||||
typedef void CURL;
|
||||
|
||||
/*
|
||||
* Decorate exportable functions for Win32 and Symbian OS DLL linking.
|
||||
* This avoids using a .def file for building libcurl.dll.
|
||||
* libcurl external API function linkage decorations.
|
||||
*/
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
|
||||
!defined(CURL_STATICLIB)
|
||||
#if defined(BUILDING_LIBCURL)
|
||||
#define CURL_EXTERN __declspec(dllexport)
|
||||
#else
|
||||
#define CURL_EXTERN __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
|
||||
#ifdef CURL_HIDDEN_SYMBOLS
|
||||
/*
|
||||
* This definition is used to make external definitions visible in the
|
||||
* shared library when symbols are hidden by default. It makes no
|
||||
* difference when compiling applications whether this is set or not,
|
||||
* only when compiling the library.
|
||||
*/
|
||||
#define CURL_EXTERN CURL_EXTERN_SYMBOL
|
||||
#ifdef CURL_STATICLIB
|
||||
# define CURL_EXTERN
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
|
||||
# if defined(BUILDING_LIBCURL)
|
||||
# define CURL_EXTERN __declspec(dllexport)
|
||||
# else
|
||||
# define CURL_EXTERN __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
|
||||
# define CURL_EXTERN CURL_EXTERN_SYMBOL
|
||||
#else
|
||||
#define CURL_EXTERN
|
||||
#endif
|
||||
# define CURL_EXTERN
|
||||
#endif
|
||||
|
||||
#ifndef curl_socket_typedef
|
||||
|
@ -37,13 +37,16 @@ EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 config-win32.h \
|
||||
objnames-test08.sh objnames-test10.sh objnames.inc
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
LIBCURL_LIBS = @LIBCURL_LIBS@
|
||||
|
||||
if BUILD_UNITTESTS
|
||||
noinst_LTLIBRARIES = libcurlu.la
|
||||
else
|
||||
noinst_LTLIBRARIES =
|
||||
endif
|
||||
|
||||
# This might hold -Werror
|
||||
CFLAGS += @CURL_CFLAG_EXTRAS@
|
||||
|
||||
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
|
||||
|
||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
||||
# $(top_builddir), to ensure that these paths which belong to the library
|
||||
# being currently built and tested are searched before the library which
|
||||
@ -76,16 +79,6 @@ endif
|
||||
# Prevent LIBS from being used for all link targets
|
||||
LIBS = $(BLANK_AT_MAKETIME)
|
||||
|
||||
# Mostly for Windows build targets, when building libcurl library
|
||||
if USE_CPPFLAG_BUILDING_LIBCURL
|
||||
AM_CPPFLAGS += -DBUILDING_LIBCURL
|
||||
endif
|
||||
|
||||
# Mostly for Windows build targets, when building static libcurl
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
|
||||
if SONAME_BUMP
|
||||
#
|
||||
# Bumping of SONAME conditionally may seem like a weird thing to do, and yeah
|
||||
@ -114,9 +107,13 @@ endif
|
||||
#
|
||||
# For the full guide on libcurl ABI rules, see docs/libcurl/ABI
|
||||
|
||||
AM_CPPFLAGS += -DBUILDING_LIBCURL
|
||||
AM_LDFLAGS =
|
||||
AM_CFLAGS =
|
||||
|
||||
libcurl_la_CPPFLAGS_EXTRA =
|
||||
libcurl_la_LDFLAGS_EXTRA =
|
||||
libcurl_la_CFLAGS_EXTRA =
|
||||
|
||||
if CURL_LT_SHLIB_USE_VERSION_INFO
|
||||
libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO)
|
||||
@ -134,25 +131,21 @@ if CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS
|
||||
libcurl_la_LDFLAGS_EXTRA += -Wl,--version-script=libcurl.vers
|
||||
endif
|
||||
|
||||
libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LIBCURL_LIBS)
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB
|
||||
endif
|
||||
|
||||
if DOING_CURL_SYMBOL_HIDING
|
||||
libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS
|
||||
libcurl_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_CURL_SYMBOL_HIDING)
|
||||
else
|
||||
libcurl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
libcurl_la_CFLAGS = $(AM_CFLAGS)
|
||||
libcurl_la_CPPFLAGS_EXTRA += -DCURL_HIDDEN_SYMBOLS
|
||||
libcurl_la_CFLAGS_EXTRA += $(CFLAG_CURL_SYMBOL_HIDING)
|
||||
endif
|
||||
|
||||
# unit testing static library built only along with unit tests
|
||||
if BUILD_UNITTESTS
|
||||
noinst_LTLIBRARIES = libcurlu.la
|
||||
else
|
||||
noinst_LTLIBRARIES =
|
||||
endif
|
||||
libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcurl_la_CPPFLAGS_EXTRA)
|
||||
libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LIBCURL_LIBS)
|
||||
libcurl_la_CFLAGS = $(AM_CFLAGS) $(libcurl_la_CFLAGS_EXTRA)
|
||||
|
||||
libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DUNITTESTS
|
||||
libcurlu_la_LDFLAGS = -static $(LIBCURL_LIBS)
|
||||
libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS
|
||||
libcurlu_la_LDFLAGS = $(AM_LDFLAGS) -static $(LIBCURL_LIBS)
|
||||
libcurlu_la_CFLAGS = $(AM_CFLAGS)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
|
@ -44,7 +44,6 @@ AM_CPPFLAGS = -I$(top_builddir)/include/curl \
|
||||
|
||||
bin_PROGRAMS = curl
|
||||
|
||||
# Mostly for Windows build targets, when using static libcurl
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@ -70,11 +70,6 @@ endif
|
||||
LDADD = $(SUPPORTFILES_LIBS)
|
||||
DEPENDENCIES = $(top_builddir)/lib/libcurl.la
|
||||
|
||||
# Mostly for Windows build targets, when using static libcurl
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
|
||||
# Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES,
|
||||
# noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS)
|
||||
include Makefile.inc
|
||||
@ -88,25 +83,35 @@ else
|
||||
noinst_LTLIBRARIES =
|
||||
endif
|
||||
|
||||
AM_LDFLAGS =
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
|
||||
AM_LDFLAGS =
|
||||
AM_CFLAGS =
|
||||
|
||||
libhostname_la_CPPFLAGS_EXTRA =
|
||||
libhostname_la_LDFLAGS_EXTRA = -module -avoid-version -rpath /nowhere
|
||||
libhostname_la_CFLAGS_EXTRA =
|
||||
|
||||
if CURL_LT_SHLIB_USE_NO_UNDEFINED
|
||||
libhostname_la_LDFLAGS_EXTRA += -no-undefined
|
||||
endif
|
||||
|
||||
if CURL_LT_SHLIB_USE_MIMPURE_TEXT
|
||||
libhostname_la_LDFLAGS_EXTRA += -mimpure-text
|
||||
endif
|
||||
|
||||
if DOING_CURL_SYMBOL_HIDING
|
||||
libhostname_la_CPPFLAGS_EXTRA += -DCURL_HIDDEN_SYMBOLS
|
||||
libhostname_la_CFLAGS_EXTRA += $(CFLAG_CURL_SYMBOL_HIDING)
|
||||
endif
|
||||
|
||||
libhostname_la_CPPFLAGS = $(AM_CPPFLAGS) $(libhostname_la_CPPFLAGS_EXTRA)
|
||||
libhostname_la_LDFLAGS = $(AM_LDFLAGS) $(libhostname_la_LDFLAGS_EXTRA)
|
||||
libhostname_la_CFLAGS = $(AM_CFLAGS) $(libhostname_la_CFLAGS_EXTRA)
|
||||
|
||||
libhostname_la_SOURCES = sethostname.c sethostname.h
|
||||
|
||||
libhostname_la_LIBADD =
|
||||
libhostname_la_DEPENDENCIES =
|
||||
|
||||
if DOING_CURL_SYMBOL_HIDING
|
||||
libhostname_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS
|
||||
libhostname_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_CURL_SYMBOL_HIDING)
|
||||
else
|
||||
libhostname_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
libhostname_la_CFLAGS = $(AM_CFLAGS)
|
||||
endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -20,18 +20,18 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#if (defined(WIN32) || defined(__SYMBIAN32__)) && !defined(CURL_STATICLIB)
|
||||
#ifdef CURL_STATICLIB
|
||||
# define LIBHOSTNAME_EXTERN
|
||||
#elif defined(WIN32) || defined(__SYMBIAN32__)
|
||||
# if defined(BUILDING_LIBCURL)
|
||||
# define LIBHOSTNAME_EXTERN __declspec(dllexport)
|
||||
# else
|
||||
# define LIBHOSTNAME_EXTERN __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CURL_HIDDEN_SYMBOLS
|
||||
#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
|
||||
# define LIBHOSTNAME_EXTERN CURL_EXTERN_SYMBOL
|
||||
# else
|
||||
#else
|
||||
# define LIBHOSTNAME_EXTERN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
|
@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@ -59,12 +59,7 @@ LIBS = $(BLANK_AT_MAKETIME)
|
||||
|
||||
LDADD = $(top_builddir)/lib/libcurlu.la @LDFLAGS@ @LIBCURL_LIBS@
|
||||
DEPENDENCIES = $(top_builddir)/lib/libcurlu.la
|
||||
AM_CPPFLAGS += -DUNITTESTS
|
||||
|
||||
# Mostly for Windows build targets, when using static libcurl
|
||||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
|
||||
|
||||
# Makefile.inc provides neat definitions
|
||||
include Makefile.inc
|
||||
|
Loading…
Reference in New Issue
Block a user