Skip to content

Commit

Permalink
autotools: more robust RC condition
Browse files Browse the repository at this point in the history
Previous solution assumed that when building a Windows target, `RC` tool
is available and auto-detected by autotools. Sometime this is not true.

Rename and extend the `OS_WINDOWS` conditional to also check if `RC` is
set. Effectively this patch replaces a hard error with just not building
the resources.

The correct fix is (possibly) to set the TRIPLET to a valid one (so that
auto-detection works correctly), and a workaround is to manually point
the `RC` envvar to a working copy of `windres`.

[^1]: https://tg.st/u/ad68a31462958a3ef0c801258bf5e8dde310d9fe062416d37d42f1e996af6bdb.txt

Follow-up to 6de7322

Ref: https://curl.se/mail/lib-2022-10/0049.html

Closes curl#9781
  • Loading branch information
vszakats committed Oct 22, 2022
1 parent c2e9376 commit fcfc1b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Expand Up @@ -570,7 +570,8 @@ CURL_DARWIN_CFLAGS
CURL_DARWIN_SYSTEMCONFIGURATION
CURL_SUPPORTS_BUILTIN_AVAILABLE

AM_CONDITIONAL([OS_WINDOWS], [test "$curl_cv_native_windows" = "yes"])
AM_CONDITIONAL([HAVE_WINDRES],
test "$curl_cv_native_windows" = "yes" && test -n "${RC}")

dnl ************************************************************
dnl switch off particular protocols
Expand Down
4 changes: 2 additions & 2 deletions lib/Makefile.am
Expand Up @@ -109,7 +109,7 @@ endif
if USE_CPPFLAG_CURL_STATICLIB
libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB
else
if OS_WINDOWS
if HAVE_WINDRES
libcurl_la_SOURCES += $(LIB_RCFILES)
$(LIB_RCFILES): $(top_srcdir)/include/curl/curlver.h
endif
Expand Down Expand Up @@ -154,7 +154,7 @@ tidy:
optiontable:
perl optiontable.pl < $(top_srcdir)/include/curl/curl.h > easyoptions.c

if OS_WINDOWS
if HAVE_WINDRES
# Warning is "normal": libtool: error: ignoring unknown tag RC
.rc.lo:
$(LIBTOOL) --tag=RC --mode=compile $(RC) -I$(top_srcdir)/include $(RCFLAGS) -i $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.am
Expand Up @@ -55,7 +55,7 @@ include Makefile.inc

# CURL_FILES comes from Makefile.inc
curl_SOURCES = $(CURL_FILES)
if OS_WINDOWS
if HAVE_WINDRES
curl_SOURCES += $(CURL_RCFILES)
$(CURL_RCFILES): tool_version.h
endif
Expand Down Expand Up @@ -156,7 +156,7 @@ tidy:
listhelp:
(cd $(top_srcdir)/docs/cmdline-opts && ./gen.pl listhelp *.d) > tool_listhelp.c

if OS_WINDOWS
if HAVE_WINDRES
# Warning is "normal": libtool: error: ignoring unknown tag RC
.rc.o:
$(LIBTOOL) --tag=RC --mode=compile $(RC) -I$(top_srcdir)/include -DCURL_EMBED_MANIFEST $(RCFLAGS) -i $< -o $@
Expand Down

0 comments on commit fcfc1b9

Please sign in to comment.