Be warned I am no autotools expert.
A review would be very helpful. :)

CC+ alexey for help on that :)
From cd7023eb40a970e3a8293cdbcb0639450cf4d223 Mon Sep 17 00:00:00 2001
From: Martell Malone <[email protected]>
Date: Wed, 4 Nov 2015 18:47:54 +0000
Subject: [PATCH] configure.ac: add support for --enable-genlib


diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index a137750..f071068 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -22,19 +22,33 @@ endif
 AM_CPPFLAGS=-D_CRTBLD $(sysincludes)
 AM_CFLAGS=-pipe -std=gnu99 -D_WIN32_WINNT=0x0f00 @ADD_C_CXX_WARNING_FLAGS@ 
@ADD_C_ONLY_WARNING_FLAGS@
 AM_CXXFLAGS=@ADD_C_CXX_WARNING_FLAGS@ @ADD_CXX_ONLY_WARNING_FLAGS@
-AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@
-if DELAY_IMPORT_LIBS
-  AM_DLLTOOLFLAGS += --output-delaylib [email protected]
+if ENABLE_GENLIB
+  AM_DLLTOOLFLAGS=-o $@
+else
+  AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@
+  if DELAY_IMPORT_LIBS
+    AM_DLLTOOLFLAGS += --output-delaylib [email protected]
+  endif
 endif
+
 CPPFLAGSARM32=-mfpu=vfp
 CPPFLAGS32=-m32
 CPPFLAGS64=-m64
-DLLTOOLFLAGSARM32=
-DLLTOOLFLAGS32=--as-flags=--32 -m i386
-DLLTOOLFLAGS64=--as-flags=--64 -m i386:x86-64
-DTDEFARM32=$(DLLTOOL) $(DLLTOOLFLAGSARM32) $(AM_DLLTOOLFLAGS) --input-def
-DTDEF32=$(DLLTOOL) $(DLLTOOLFLAGS32) $(AM_DLLTOOLFLAGS) --input-def
-DTDEF64=$(DLLTOOL) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS) --input-def
+if ENABLE_GENLIB
+  DLLTOOLFLAGSARM32=-a arm
+  DLLTOOLFLAGS32=-a x86
+  DLLTOOLFLAGS64=-a x86-64
+  DTDEFARM32=$(GENLIB) $(DLLTOOLFLAGSARM32) $(AM_DLLTOOLFLAGS)
+  DTDEF32=$(GENLIB) $(DLLTOOLFLAGS32) $(AM_DLLTOOLFLAGS)
+  DTDEF64=$(GENLIB) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS)
+else
+  DLLTOOLFLAGSARM32=
+  DLLTOOLFLAGS32=--as-flags=--32 -m i386
+  DLLTOOLFLAGS64=--as-flags=--64 -m i386:x86-64
+  DTDEFARM32=$(DLLTOOL) $(DLLTOOLFLAGSARM32) $(AM_DLLTOOLFLAGS) --input-def
+  DTDEF32=$(DLLTOOL) $(DLLTOOLFLAGS32) $(AM_DLLTOOLFLAGS) --input-def
+  DTDEF64=$(DLLTOOL) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS) --input-def
+endif
 DTLIBARM32=$(DTDEFARM32) $(top_srcdir)/`echo $@ | $(SED) 
's|/lib|/|;s|\.a|.def|'`
 DTLIB32=$(DTDEF32) $(top_srcdir)/`echo $@ | $(SED) 's|/lib|/|;s|\.a|.def|'`
 DTLIB64=$(DTDEF64) $(top_srcdir)/`echo $@ | $(SED) 's|/lib|/|;s|\.a|.def|'`
diff --git a/mingw-w64-crt/configure.ac b/mingw-w64-crt/configure.ac
index 788779c..9b1cb0d 100644
--- a/mingw-w64-crt/configure.ac
+++ b/mingw-w64-crt/configure.ac
@@ -40,6 +40,7 @@ AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_RANLIB
 AC_CHECK_TOOL([DLLTOOL], [dlltool], [:])
+AC_CHECK_TOOL([GENLIB], [genlib], [:])
 AM_PROG_AR
 AM_PROG_AS
 dnl Remove this once automake fixes the bug where AS is not defined according 
to $host
@@ -161,6 +162,19 @@ AC_SUBST([LIBARM32SUFFIXDIR],[$libarm32suffx])
 
 # Checks for features.
 
+AC_MSG_CHECKING([whether to enable genlib])
+AC_ARG_ENABLE([genlib],
+  [AS_HELP_STRING([--enable-genlib],
+    [Enable building import libraries via the mingw-w64-tools genlib])],
+  [],
+  [enable_genlib=no])
+AS_CASE([$enable_genlib],
+  [yes],[enable_genlib_value=-1],
+  [no],[enable_genlib_value=0],
+  [AC_MSG_ERROR([Please only use --enable-genlib or --disable-genlib, without 
any additional arguments.])])
+AC_DEFINE_UNQUOTED([ENABLE_GENLIB],[$enable_genlib_value],[Define as -1 to 
enable genlib or 0 to disable it.])
+AC_MSG_RESULT([$enable_genlib])
+
 AC_MSG_CHECKING([whether to enable globbing])
 AC_ARG_ENABLE([wildcard],
   [AS_HELP_STRING([--enable-wildcard],
-- 
2.5.0

------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to