aboutsummaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-08-19 11:27:17 +0000
committerChristian Grothoff <christian@grothoff.org>2010-08-19 11:27:17 +0000
commit02dc5b39a1e27c94cedb5a8db622788d8873df59 (patch)
tree5b35cef6d935ad81daf26d78593d423933b71ed5 /acinclude.m4
parent24687543ab73f35eb1bcd8e2858e2f940f40409f (diff)
downloadlibmicrohttpd-02dc5b39a1e27c94cedb5a8db622788d8873df59.tar.gz
libmicrohttpd-02dc5b39a1e27c94cedb5a8db622788d8873df59.zip
[libmicrohttpd] Patches for Windows version of libmicrohttpd
From: Gerrit Telkamp <g.telkamp@domologic.de> To: libmicrohttpd@gnu.org Date: Today 11:42:30 Attachments: libmicrohttpd-windows.patch It was a bit tricky to build libmicrohttpd (SVN trunk) for Windows. I'm using the newest MSYS/MinGW environment (GCC 4.5.1). I've optimized the autoconf feature, so this should be easier in future. Please find enclosed my patches. In detail: 1- libmicrohttpd needs the "PlibC" library under Windows (libplibc.a). Methods of PlibC are referenced by src/daemon/daemon.c. autoconf assumes that PlibC is installed on the Build environment and does not check this. If PlibC is not installed, the pthreads check (see "acinclude.m4") will fail and stops with the wrong error message "Your system is not supporting pthreads". This is very confusing. The patch includes an additional check for PlibC, before pthreads is used. The check is only done under cygwin and mingw environments. Furthermore, an older version of plibc.h was in the include directory. This gives some problems if you are using a newer version of the PlibC library. So I propose to exclude src/include/plibc.h from the SVN Files affected: acinclude.m4 (modified) configure.ac (modified) src/include/plibc.h (deleted) 2- setsockopt() uses a different parameter type under Windows ("optval" is const char). This caused an error when src/daemon/daemon.c was compiled. The patch enclosed includes a different call of the setsockopt() on Windows machines. Important: IPV6_V6ONLY is not available on Windows machines < Windows 7! So this parameter is "0". But there is a TODO comment, maybe someone has an idea how to solve this on Windows XP machines. Files affected: src/daemon/daemon.c (modified) I have tested the patch on a MinGW / MSYS environment only. Best regards Gerrit. libmicrohttpd-windows.patch
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m4183
1 files changed, 113 insertions, 70 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 652d4357..ff681ac0 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,75 +1,118 @@
1AC_DEFUN([CHECK_PLIBC],
2[
3 # On windows machines, check if PlibC is available. First try without -plibc
4 AC_TRY_LINK(
5 [
6 #include <plibc.h>
7 ],[
8 plibc_init("", "");
9 ],[
10 AC_MSG_RESULT(yes)
11 PLIBC_CPPFLAGS=
12 PLIBC_LDFLAGS=
13 PLIBC_LIBS=
14 ],[
15
16 # now with -plibc
17 AC_CHECK_LIB(plibc,plibc_init,
18 [
19 PLIBC_CPPFLAGS=
20 PLIBC_LDFLAGS=
21 PLIBC_LIBS=-lplibc
22 ],[
23 AC_MSG_CHECKING(if PlibC is installed)
24 save_CPPFLAGS="$CPPFLAGS"
25 CPPFLAGS="$CPPFLAGS -plibc"
26 AC_TRY_LINK(
27 [
28 #include <plibc.h>
29 ],[
30 plibc_init("", "");
31 ],[
32 AC_MSG_RESULT(yes)
33 PLIBC_CPPFLAGS=-plibc
34 PLIBC_LDFLAGS=-plibc
35 PLIBC_LIBS=
36 ],[
37 AC_MSG_ERROR([PlibC is not available on your windows machine!])
38 ])
39 ])
40 ])
41 CPPFLAGS="$save_CPPFLAGS"
42])
43
1# See: http://gcc.gnu.org/ml/gcc/2000-05/msg01141.html 44# See: http://gcc.gnu.org/ml/gcc/2000-05/msg01141.html
2AC_DEFUN([CHECK_PTHREAD], 45AC_DEFUN([CHECK_PTHREAD],
3[ 46[
4 # first try without -pthread 47 # first try without -pthread
5 AC_TRY_LINK( 48 AC_TRY_LINK(
6 [ 49 [
7 #include <pthread.h> 50 #include <pthread.h>
8 ],[ 51 ],[
9 pthread_create(0,0,0,0); 52 pthread_create(0,0,0,0);
10 ],[ 53 ],[
11 AC_MSG_RESULT(yes) 54 AC_MSG_RESULT(yes)
12 PTHREAD_CPPFLAGS= 55 PTHREAD_CPPFLAGS=
13 PTHREAD_LDFLAGS= 56 PTHREAD_LDFLAGS=
14 PTHREAD_LIBS= 57 PTHREAD_LIBS=
15 ],[ 58 ],[
16 # now with -pthread 59
17 AC_CHECK_LIB(pthread,pthread_create, 60 # now with -pthread
18 [ 61 AC_CHECK_LIB(pthread,pthread_create,
19 PTHREAD_CPPFLAGS= 62 [
20 PTHREAD_LDFLAGS= 63 PTHREAD_CPPFLAGS=
21 PTHREAD_LIBS=-lpthread 64 PTHREAD_LDFLAGS=
22 ],[ 65 PTHREAD_LIBS=-lpthread
23 AC_MSG_CHECKING(if compiler supports -pthread) 66 ],[
24 save_CPPFLAGS="$CPPFLAGS" 67 AC_MSG_CHECKING(if compiler supports -pthread)
25 CPPFLAGS="$CPPFLAGS -pthread" 68 save_CPPFLAGS="$CPPFLAGS"
26 AC_TRY_LINK( 69 CPPFLAGS="$CPPFLAGS -pthread"
27 [ 70 AC_TRY_LINK(
28 #include <pthread.h> 71 [
29 ],[ 72 #include <pthread.h>
30 pthread_create(0,0,0,0); 73 ],[
31 ],[ 74 pthread_create(0,0,0,0);
32 AC_MSG_RESULT(yes) 75 ],[
33 PTHREAD_CPPFLAGS=-pthread 76 AC_MSG_RESULT(yes)
34 PTHREAD_LDFLAGS=-pthread 77 PTHREAD_CPPFLAGS=-pthread
35 PTHREAD_LIBS= 78 PTHREAD_LDFLAGS=-pthread
36 ],[ 79 PTHREAD_LIBS=
37 AC_MSG_RESULT(no) 80 ],[
38 AC_MSG_CHECKING(if compiler supports -pthreads) 81 AC_MSG_RESULT(no)
39 save_CPPFLAGS="$CPPFLAGS" 82 AC_MSG_CHECKING(if compiler supports -pthreads)
40 CPPFLAGS="$save_CPPFLAGS -pthreads" 83 save_CPPFLAGS="$CPPFLAGS"
41 AC_TRY_LINK( 84 CPPFLAGS="$save_CPPFLAGS -pthreads"
42 [ 85 AC_TRY_LINK(
43 #include <pthread.h> 86 [
44 ],[ 87 #include <pthread.h>
45 pthread_create(0,0,0,0); 88 ],[
46 ],[ 89 pthread_create(0,0,0,0);
47 AC_MSG_RESULT(yes) 90 ],[
48 PTHREAD_CPPFLAGS=-pthreads 91 AC_MSG_RESULT(yes)
49 PTHREAD_LDFLAGS=-pthreads 92 PTHREAD_CPPFLAGS=-pthreads
50 PTHREAD_LIBS= 93 PTHREAD_LDFLAGS=-pthreads
51 ],[ 94 PTHREAD_LIBS=
52 AC_MSG_RESULT(no) 95 ],[
53 AC_MSG_CHECKING(if compiler supports -threads) 96 AC_MSG_RESULT(no)
54 save_CPPFLAGS="$CPPFLAGS" 97 AC_MSG_CHECKING(if compiler supports -threads)
55 CPPFLAGS="$save_CPPFLAGS -threads" 98 save_CPPFLAGS="$CPPFLAGS"
56 AC_TRY_LINK( 99 CPPFLAGS="$save_CPPFLAGS -threads"
57 [ 100 AC_TRY_LINK(
58 #include <pthread.h> 101 [
59 ],[ 102 #include <pthread.h>
60 pthread_create(0,0,0,0); 103 ],[
61 ],[ 104 pthread_create(0,0,0,0);
62 AC_MSG_RESULT(yes) 105 ],[
63 PTHREAD_CPPFLAGS=-threads 106 AC_MSG_RESULT(yes)
64 PTHREAD_LDFLAGS=-threads 107 PTHREAD_CPPFLAGS=-threads
65 PTHREAD_LIBS= 108 PTHREAD_LDFLAGS=-threads
66 ],[ 109 PTHREAD_LIBS=
67 AC_MSG_ERROR([Your system is not supporting pthreads!]) 110 ],[
68 ]) 111 AC_MSG_ERROR([Your system is not supporting pthreads!])
69 ]) 112 ])
70 ]) 113 ])
71 CPPFLAGS="$save_CPPFLAGS" 114 ])
72 ]) 115 CPPFLAGS="$save_CPPFLAGS"
73
74 ]) 116 ])
117 ])
75]) 118])