Re: Building 4.62 on mingw64
Chris Matrakidis <[email protected]>
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <CAEaJ3S73o8zuALBgUrgHt0aaOEvgoseTie3R0inXeoV9RGrg=w@mail.gmail.com> |
Andrew, > Another way: > > ./configure --disable-reentrant There is a second problem with mingw on 64 bit windows, so this still won't work: The tv_sec field in struct timeval is 32 bit while time_t is 64 bit. Looking at msdn this seems like a microsoft header issue. The attached patch tries to correct both issues, by adding a configure check that the tv_sec field size is the same as the time_t size and by defining __WOE__ for mingw to get the *_s thread safe functions instead of the *_r ones. It has been tested to work on 64 bit mingw with configure run under msys2 (thanks Rob) and on linux where it doesn't change anything. Best Regards, Chris Matrakidis _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
mingw.patch
(application/octet-stream, 1.3 KB)
diff --git a/config.h.in b/config.h.in
index 794e00c..dde837a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -27,4 +27,7 @@
#undef TLS
/* thread local storage-class specifier for re-entrancy (if any) */
+#undef __WOE__
+/* for windows native compilers */
+
/* eof */
diff --git a/configure.ac b/configure.ac
index c9b3aea..1068cd8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,7 +71,13 @@ AC_CHECK_LIB([m], [exp])
dnl Check for <sys/time.h> header
AC_CHECK_HEADER([sys/time.h],
- AC_DEFINE([HAVE_SYS_TIME_H], [1], [N/A]))
+ ## Check for 64bit windows timeval type issue (tv_sec is not time_t)
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ #include <sys/time.h>
+ enum {x = 1/(!!(sizeof(time_t) ==
+ sizeof(((struct timeval *)0)->tv_sec)))
+ };])], [AC_DEFINE([HAVE_SYS_TIME_H], [1], [N/A])],
+ [[AC_MSG_WARN([sys/time.h not used, tv_sec is not time_t])]]))
dnl Check for gettimeofday function
AC_CHECK_FUNC([gettimeofday],
@@ -190,6 +196,16 @@ case "${host}" in
esac
AC_SUBST([NOUNDEFINED])
+AC_MSG_CHECKING([for windows native compiler])
+case "${host}" in *-*-mingw*)
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([__WOE__], [1], [N/A])
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+esac
+
AC_CONFIG_FILES(
[src/Makefile examples/Makefile Makefile])
AC_OUTPUT