From 8a9b2149b70c6fe47915f6be3789658a34847efa Mon Sep 17 00:00:00 2001 From: Louie S Date: Sat, 4 Mar 2023 15:05:35 -0800 Subject: Implement checking for windres tool in configure.ac --- Makefile.in | 1 + configure | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 6 ++++ data/Makefile.in | 1 + docs/Makefile.in | 1 + spec/Makefile.in | 1 + src/Makefile.am | 2 +- src/Makefile.in | 3 +- 8 files changed, 113 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index c731df4..b802306 100644 --- a/Makefile.in +++ b/Makefile.in @@ -283,6 +283,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WINDRES = @WINDRES@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/configure b/configure index 845650a..538dda3 100755 --- a/configure +++ b/configure @@ -625,6 +625,7 @@ LTLIBOBJS LIBOBJS EMBED_ICON_FALSE EMBED_ICON_TRUE +WINDRES DESKTOP_ENTRY_FALSE DESKTOP_ENTRY_TRUE WINDOWS_FALSE @@ -5753,6 +5754,105 @@ if test "${enable_embed_icon+set}" = set; then : enableval=$enable_embed_icon; embed_icon=no fi +if test "x$embed_icon" = "xyes"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. +set dummy ${ac_tool_prefix}windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$WINDRES"; then + ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_WINDRES="${ac_tool_prefix}windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +WINDRES=$ac_cv_prog_WINDRES +if test -n "$WINDRES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 +$as_echo "$WINDRES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_WINDRES"; then + ac_ct_WINDRES=$WINDRES + # Extract the first word of "windres", so it can be a program name with args. +set dummy windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_WINDRES"; then + ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_WINDRES="windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES +if test -n "$ac_ct_WINDRES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_WINDRES" >&5 +$as_echo "$ac_ct_WINDRES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_WINDRES" = x; then + WINDRES="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + WINDRES=$ac_ct_WINDRES + fi +else + WINDRES="$ac_cv_prog_WINDRES" +fi + + if ${WINDRES:+false} :; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot embed icon" >&5 +$as_echo "$as_me: WARNING: Cannot embed icon" >&2;} + embed_icon=no +fi +fi if test "$embed_icon" = "yes"; then EMBED_ICON_TRUE= EMBED_ICON_FALSE='#' diff --git a/configure.ac b/configure.ac index 5d958ca..78ee96c 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,12 @@ AC_ARG_ENABLE([embed_icon], [AS_HELP_STRING([--disable-embed-icon], [embed icon in windows executable (default is yes)])], [embed_icon=no]) +if test "x$embed_icon" = "xyes"; then + AC_CHECK_TOOL([WINDRES], [windres]) + AS_VAR_IF([WINDRES], [], + [AC_MSG_WARN([Cannot embed icon]) + embed_icon=no]) +fi AM_CONDITIONAL([EMBED_ICON], [test "$embed_icon" = "yes"]) AC_CONFIG_FILES([Makefile diff --git a/data/Makefile.in b/data/Makefile.in index 1720180..6bba3e5 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -198,6 +198,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WINDRES = @WINDRES@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/docs/Makefile.in b/docs/Makefile.in index 62c84cf..e9052e0 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -199,6 +199,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WINDRES = @WINDRES@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/spec/Makefile.in b/spec/Makefile.in index ed27fbf..1b4cc60 100644 --- a/spec/Makefile.in +++ b/spec/Makefile.in @@ -169,6 +169,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WINDRES = @WINDRES@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/src/Makefile.am b/src/Makefile.am index 9e670c6..80a550c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ BUILT_SOURCES = icon/$(PACKAGE_NAME).res CLEANFILES = icon/$(PACKAGE_NAME).res icon/$(PACKAGE_NAME).res: icon/$(PACKAGE_NAME).ico icon/$(PACKAGE_NAME).rc - windres icon/$(PACKAGE_NAME).rc -O coff -o $@ + $(WINDRES) icon/$(PACKAGE_NAME).rc -O coff -o $@ endif else diff --git a/src/Makefile.in b/src/Makefile.in index 93e4ac6..f2f4742 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -242,6 +242,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WINDRES = @WINDRES@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -782,7 +783,7 @@ uninstall-am: uninstall-binPROGRAMS @EMBED_ICON_TRUE@@WINDOWS_TRUE@icon/$(PACKAGE_NAME).res: icon/$(PACKAGE_NAME).ico icon/$(PACKAGE_NAME).rc -@EMBED_ICON_TRUE@@WINDOWS_TRUE@ windres icon/$(PACKAGE_NAME).rc -O coff -o $@ +@EMBED_ICON_TRUE@@WINDOWS_TRUE@ $(WINDRES) icon/$(PACKAGE_NAME).rc -O coff -o $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. -- cgit