aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2015-07-09 19:24:05 +0200
committerEven Rouault <even.rouault@spatialys.com>2015-07-09 19:24:05 +0200
commit9f05b2dd07712d35fe3fa78934631b6a0142891f (patch)
tree7f60956bddca449be290ffda0298e40e524e9d98 /src
parentd895a12eee04c04a254f2a5a759f763e2fc28519 (diff)
downloadPROJ-9f05b2dd07712d35fe3fa78934631b6a0142891f.tar.gz
PROJ-9f05b2dd07712d35fe3fa78934631b6a0142891f.zip
Make multistresstext.exe compile, and work, with mingw cross compiler (autoconf build)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile.in5
-rw-r--r--src/multistresstest.c24
3 files changed, 27 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a996cbae..e53e7082 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,8 +24,8 @@ proj_LDADD = libproj.la
cs2cs_LDADD = libproj.la
nad2bin_LDADD = libproj.la
geod_LDADD = libproj.la
-multistresstest_LDADD = libproj.la -lpthread
-test228_LDADD = libproj.la -lpthread
+multistresstest_LDADD = libproj.la @THREAD_LIB@
+test228_LDADD = libproj.la @THREAD_LIB@
lib_LTLIBRARIES = libproj.la
diff --git a/src/Makefile.in b/src/Makefile.in
index a71265df..856cd107 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -324,6 +324,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -398,8 +399,8 @@ proj_LDADD = libproj.la
cs2cs_LDADD = libproj.la
nad2bin_LDADD = libproj.la
geod_LDADD = libproj.la
-multistresstest_LDADD = libproj.la -lpthread
-test228_LDADD = libproj.la -lpthread
+multistresstest_LDADD = libproj.la @THREAD_LIB@
+test228_LDADD = libproj.la @THREAD_LIB@
lib_LTLIBRARIES = libproj.la
libproj_la_LDFLAGS = -no-undefined -version-info 9:0:0
libproj_la_SOURCES = \
diff --git a/src/multistresstest.c b/src/multistresstest.c
index d9c9aea0..e9da3323 100644
--- a/src/multistresstest.c
+++ b/src/multistresstest.c
@@ -287,8 +287,11 @@ static void *PosixTestThread( void *pData )
/************************************************************************/
/* main() */
/************************************************************************/
-int main( int argc, char **argv )
-
+#ifdef _WIN32
+static DWORD WINAPI do_main( LPVOID unused )
+#else
+int do_main(void)
+#endif
{
/* -------------------------------------------------------------------- */
/* Our first pass is to establish the correct answers for all */
@@ -393,3 +396,20 @@ int main( int argc, char **argv )
return 0;
}
+
+
+int main( int argc, char **argv )
+{
+#ifdef _WIN32
+ /* This is an incredible weirdness but with mingw cross-compiler */
+ /* 1. - b/a; where double a = 6378206.4; and double b = 6356583.8; */
+ /* does not evaluate the same in the main thread or in a thread forked */
+ /* by CreateThread(), so run the main in a thread... */
+ HANDLE thread = CreateThread(NULL, 0, do_main, NULL, 0, NULL);
+ WaitForSingleObject(thread, INFINITE);
+ CloseHandle( thread );
+#else
+ do_main();
+#endif
+ return 0;
+}