autotools: accept linker flags via CURL_LDFLAGS_{LIB,BIN}

To allow passing `LDFLAGS` specific to libcurl (`CURL_LDFLAGS_LIB`) and
curl tool (`CURL_LDFLAGS_BIN`).

This makes it possible to build libcurl and curl with a single
invocation with lib- and tool-specific custom linker flags.

Such flag can be enabling `.map` files, a `.def` file for libcurl DLL,
controlling static/shared, incl. requesting a static curl tool (with
`-static-libtool-libs`) while building both shared and static libcurl.

curl-for-win uses the above and some more.

These options are already supported in `Makefile.mk`. CMake has built-in
variables for this.

Closes #12312
This commit is contained in:
Viktor Szakats 2023-11-13 00:02:45 +00:00
parent efbbbf4f7a
commit b365a34c60
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 3 additions and 1 deletions

View File

@ -110,7 +110,7 @@ libcurl_la_CFLAGS_EXTRA += $(CFLAG_CURL_SYMBOL_HIDING)
endif
libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcurl_la_CPPFLAGS_EXTRA)
libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LDFLAGS) $(LIBCURL_LIBS)
libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LDFLAGS) $(CURL_LDFLAGS_LIB) $(LIBCURL_LIBS)
libcurl_la_CFLAGS = $(AM_CFLAGS) $(libcurl_la_CFLAGS_EXTRA)
libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS

View File

@ -61,6 +61,8 @@ curl_SOURCES += $(CURL_RCFILES)
$(CURL_RCFILES): tool_version.h
endif
curl_LDFLAGS = $(AM_LDFLAGS) $(CURL_LDFLAGS_BIN)
# This might hold -Werror
CFLAGS += @CURL_CFLAG_EXTRAS@