#endif])
AC_PROG_CC
-AC_CHECK_TOOL(DLLTOOL, dlltool, :)
-AC_CHECK_TOOL(WINDRES, windres, :)
-
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
# Don't default to build static libs.
AC_DISABLE_STATIC
+AC_LIBTOOL_WIN32_DLL
+AC_LIBTOOL_RC
AC_PROG_LIBTOOL
# For now we hardcode the use of version scripts. It would be better
AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@
-libgpgme_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
+
+if HAVE_W32_SYSTEM
+
+LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
+ `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
+ sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
+
+%.o : %.rc
+ $(LTRCCOMPILE) -i $< -o $@
+
+gpgme_res = versioninfo.o
+gpgme_res_ldflag = -Wl,$(gpgme_res)
+no_undefined = -no-undefined
+export_symbols = -export-symbols $(srcdir)/gpgme.def
+
+install-def-file:
+ $(INSTALL) gpg-error.def $(DESTDIR)$(libdir)/gpgme.def
+
+uninstall-def-file:
+ -rm $(DESTDIR)$(libdir)/gpgme.def
+
+libgpgme_la_DEPENDENCIES = $(gpgme_res) gpgme.def
+
+else
+gpgme_res =
+gpgme_res_ldflag =
+no_undefined =
+export_symbols =
+install-def-file:
+uninstall-def-file:
+
+endif
+
+libgpgme_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) $(export_symbols) \
+ $(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
@LTLIBOBJS@ $(srcdir)/libgpgme.vers
status-table.h : gpgme.h
$(srcdir)/mkstatus < $(srcdir)/gpgme.h > status-table.h
-# Special code to build a DLL. The current libtool (1.5.6) is not
-# able to do this properly; we better use gcc's built in magic.
-if HAVE_W32_SYSTEM
-
-w32_o_files = ath.o conversion.o data-compat.o data-fd.o \
- data-mem.o data-stream.o data-user.o data.o debug.o \
- decrypt-verify.o decrypt.o delete.o edit.o encrypt-sign.o \
- encrypt.o engine-gpgsm.o engine.o error.o export.o genkey.o \
- get-env.o gpgme.o import.o key.o keylist.o memrchr.o \
- op-support.o passphrase.o progress.o putc_unlocked.o \
- rungpg.o sign.o signers.o trust-item.o trustlist.o \
- ttyname_r.o vasprintf.o verify.o version.o \
- w32-io.o w32-sema.o w32-util.o \
- wait-global.o wait-private.o wait-user.o wait.o
-
-all-local: gpgme.dll gpgme.dll.a
-
-install-exec-hook:
- cp gpgme.dll gpgme.dll.a $(DESTDIR)$(libdir)/
- $(STRIP) $(DESTDIR)$(libdir)/gpgme.dll
-
-gpgme.dll gpgme.dll.a: gpgme.def $(w32_o_files) versioninfo.o
- $(CC) -shared -o gpgme.dll $(srcdir)/gpgme.def $(w32_o_files) \
- versioninfo.o @GPG_ERROR_LIBS@ -Wl,--out-implib,gpgme.dll.a
-
-
-.rc.o:
- $(WINDRES) `test -f '$<' || echo '$(srcdir)/'`$< $@
-
-endif
+install-data-local: install-def-file
+
+uninstall-local: uninstall-def-file