[tor-commits] [tlsdate/master] Start MinGW support

ioerror at torproject.org ioerror at torproject.org
Thu Apr 25 03:03:14 UTC 2013


commit 63218359eb051fa76bd7788e369bc5c0583f0d64
Author: Jacob Appelbaum <jacob at appelbaum.net>
Date:   Wed Apr 24 18:44:39 2013 -0700

    Start MinGW support
---
 INSTALL               |    1 +
 autogen.sh            |    2 +-
 configure.ac          |   17 +++++++++++++++++
 m4/ax_platform.m4     |    4 ++++
 src/compat/clock.h    |    2 ++
 src/compat/include.am |    4 ++++
 src/include.am        |   28 ++++++++++++++++++++++++++++
 7 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/INSTALL b/INSTALL
index ebe01c4..97ca73b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -37,6 +37,7 @@ ports of tlsdate or for tlsdate integration on the following Operating Systems:
 Currently porting is in progress or partially documented for:
 
   Plan9 (with APE)
+  MingGW
 
 Building and install of tlsdate on GNU/Linux and FreeBSD:
 
diff --git a/autogen.sh b/autogen.sh
index 51c926a..efdcacc 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -23,7 +23,7 @@ then
   export WARNINGS
 fi
 
-if [ $(uname) != "CYGWIN_NT-6.1" ];
+if [ $(uname) = "CYGWIN_NT-6.1" ] || [ $(uname) = "MINGW32_NT-6.1" ];
 then
   WARNINGS=""
   export WARNINGS
diff --git a/configure.ac b/configure.ac
index b3e7df1..56f7e27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -291,6 +291,23 @@ case "$host" in
             [*], [UNPRIV_GROUP=$with_unpriv_group])
     AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
     ;;
+  *-mingw32*)
+    dnl This is for MINGW32_NT
+    dnl Check for clock_gettime.  Some systems put it into -lc, while
+    dnl others use -lrt.  Try the first and fallback to the latter.
+    RT_LIB=
+    AC_CHECK_FUNC([clock_gettime], [:],
+                  [AC_CHECK_LIB([rt], [clock_gettime], [RT_LIB="-lrt"],
+                  [AC_MSG_ERROR([Your system lacks clock_gettime])])])
+    AC_SUBST(RT_LIB)
+    AC_ARG_WITH([unpriv-group],
+                [AS_HELP_STRING([--with-unpriv-group=<group>],
+                [Group to drop privs to @<:@default: nogroup@:>@])])
+    AS_CASE([$with_unpriv_group],
+            [""|yes|no], [UNPRIV_GROUP="nogroup"],
+            [*], [UNPRIV_GROUP=$with_unpriv_group])
+    AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
+    ;;
   *-beos*|*-haiku*)
     dnl This is for BeOS and Haiku; we probably only support Haiku with gcc4
     dnl Check for clock_gettime.  Some systems put it into -lc, while
diff --git a/m4/ax_platform.m4 b/m4/ax_platform.m4
index 6e43ab8..76031d4 100644
--- a/m4/ax_platform.m4
+++ b/m4/ax_platform.m4
@@ -47,6 +47,9 @@
 # define SHUT_RDWR SD_BOTH
 #endif
           ])],
+        [*mingw*],
+        [TARGET_OS_MINGW="true"
+        AC_DEFINE([TARGET_OS_MINGW],[1],[Whether we build for MinGW])],
         [*cygwin*],
         [TARGET_OS_CYGWIN="true"
         AC_DEFINE([TARGET_OS_CYGWIN],[1],[Whether we build for Cygwin])],
@@ -77,6 +80,7 @@
         AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])])
 
   AM_CONDITIONAL([TARGET_WIN32],[test "x${TARGET_OS_WINDOWS}" = "xtrue"])
+  AM_CONDITIONAL([TARGET_MINGW],[test "x${TARGET_OS_MINGW}" = "xtrue"])
   AM_CONDITIONAL([TARGET_CYGWIN],[test "x${TARGET_OS_CYGWIN}" = "xtrue"])
   AM_CONDITIONAL([TARGET_HAIKU],[test "x${TARGET_OS_HAIKU}" = "xtrue"])
   AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OS_OSX}" = "xtrue"])
diff --git a/src/compat/clock.h b/src/compat/clock.h
index e8220bd..727940e 100644
--- a/src/compat/clock.h
+++ b/src/compat/clock.h
@@ -40,6 +40,8 @@ struct tlsdate_time {
     struct timespec tp;
 #elif TARGET_OS_CYGWIN
     struct timespec tp;
+#elif TARGET_OS_MINGW
+    struct timespec tp;
 #endif
 };
 
diff --git a/src/compat/include.am b/src/compat/include.am
index 9623362..55ebb61 100644
--- a/src/compat/include.am
+++ b/src/compat/include.am
@@ -44,6 +44,10 @@ if TARGET_CYGWIN
 src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
 endif
 
+if TARGET_MINGW
+src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
+endif
+
 if TARGET_HAIKU
 src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
 endif
diff --git a/src/include.am b/src/include.am
index a045759..3168a6c 100644
--- a/src/include.am
+++ b/src/include.am
@@ -107,6 +107,17 @@ check_PROGRAMS+= src/conf_unittest
 noinst_PROGRAMS+= src/conf_unittest
 endif
 
+if TARGET_MINGW
+bin_PROGRAMS+= src/tlsdate
+bin_PROGRAMS+= src/tlsdate-helper
+
+src_conf_unittest_SOURCES = src/conf.c
+src_conf_unittest_SOURCES+= src/conf-unittest.c
+src_conf_unittest_SOURCES+= src/common/android.c
+check_PROGRAMS+= src/conf_unittest
+noinst_PROGRAMS+= src/conf_unittest
+endif
+
 if TARGET_HAIKU
 bin_PROGRAMS+= src/tlsdate
 bin_PROGRAMS+= src/tlsdate-helper
@@ -279,6 +290,19 @@ noinst_PROGRAMS+= src/proxy-bio_unittest
 endif
 endif
 
+if TARGET_MINGW
+if !POLARSSL
+src_proxy_bio_unittest_LDADD = @SSL_LIBS@
+src_proxy_bio_unittest_SOURCES = src/proxy-bio.c
+src_proxy_bio_unittest_SOURCES+= src/proxy-bio-unittest.c
+src_proxy_bio_unittest_SOURCES+= src/test-bio.c
+src_proxy_bio_unittest_SOURCES+= src/util.c
+src_proxy_bio_unittest_SOURCES+= src/common/android.c
+check_PROGRAMS+= src/proxy-bio_unittest
+noinst_PROGRAMS+= src/proxy-bio_unittest
+endif
+endif
+
 if TARGET_HAIKU
 if !POLARSSL
 src_proxy_bio_unittest_LDADD = @SSL_LIBS@
@@ -320,6 +344,7 @@ if !TARGET_FREEBSD
 if !TARGET_DRAGONFLYBSD
 if !TARGET_HAIKU
 if !TARGET_CYGWIN
+if !TARGET_MINGW
 if !TARGET_BSD
 bin_PROGRAMS+= src/tlsdate
 bin_PROGRAMS+= src/tlsdate-helper
@@ -340,6 +365,7 @@ endif
 endif
 endif
 endif
+endif
 
 if !POLARSSL
 if !TARGET_HAIKU
@@ -351,6 +377,7 @@ if !TARGET_FREEBSD
 if !TARGET_DRAGONFLYBSD
 if !TARGET_HAIKU
 if !TARGET_CYGWIN
+if !TARGET_MINGW
 if !TARGET_BSD
 src_proxy_bio_unittest_LDADD = @SSL_LIBS@
 src_proxy_bio_unittest_SOURCES = src/proxy-bio.c
@@ -371,6 +398,7 @@ endif
 endif
 endif
 endif
+endif
 
 if !TARGET_OSX
 check_PROGRAMS+= src/test/proxy-override src/test/return-argc \





More information about the tor-commits mailing list