0

people..I'm using autotools to build my gtk2 application. I want it to make crossplatform. This is my configure.ac:

AC_PREREQ([2.67])
AC_INIT([gtk2gifviewer], [1.0.0.0], aullidolunar@gmail.com)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([main.c])
AM_INIT_AUTOMAKE

AC_PROG_CC
LT_INIT
AC_CHECK_PROG([windres],[windres],[yes],[no])
AM_CONDITIONAL([HAVE_WINDRES], [test "x$windres" = xyes])

PKG_CHECK_MODULES([gtk2], [gtk+-2.0 >= 2.20])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

and my only Makefile.am:

ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

SUFFIXES: .rc

bin_PROGRAMS = gtk2gifviewer
gtk2gifviewer_SOURCES = callbacks.c main.c
EXTRA_DIST = callbacks.h main.xpm main.ico build.txt

if HAVE_WINDRES
gtk2gifviewer_SOURCES += resource.rc
endif 

gtk2gifviewer_CFLAGS = $(gtk2_CFLAGS)
gtk2gifviewer_LDADD = $(gtk2_LIBS)

.rc.o:
    windres -o $@ $<

run: $(PACKAGE_NAME)$(EXEEXT)
    ./$<

.PHONY: run

and my simple resource file:

#include <windows.h>

app_icon ICON "main.ico"

Both icon and resource.rc are in the same folder. In linux machine build as expected. In Windows with msys I can see everything normal, no errors no warnings, but the executable doesn't have the icon. I can see the resource.o file with the same size as the icon.

Any ideas?

Joel
  • 1,805
  • 1
  • 22
  • 22
  • I would check to be sure that configure finds windres; and then I would check how the condition is emitted in the generated Makefile. – Tom Tromey Oct 19 '15 at 14:00
  • Thanks, Tom. See, I don't know how much is this a bug or a feature, but seems that I get two binaries, one in the build directory and other in .libs folder, the one in .libs directory gets the resource object linked. – Joel Oct 19 '15 at 14:28
  • Just FYI I think the `SUFFIXES: .rc` line should either be removed or changed to a variable assignment like `SUFFIXES = .rc` – Tom Tromey Oct 19 '15 at 15:11
  • The `.libs` executable is the one made by libtool. I would have thought the other one would be just a wrapper. If you `make install`, does the installed version work? – Tom Tromey Oct 19 '15 at 15:12

0 Answers0