Skip to content

Commit 79dbb77

Browse files
author
Sebastiano Merlino
committed
Modified in order to allow easy wrapping
1 parent 723513d commit 79dbb77

32 files changed

+12106
-10933
lines changed

configure.ac

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
AC_PREREQ(2.57)
2323
AC_INIT([libhttpserver], [0.1.1], [electrictwister2000@gmail.com])
2424
AM_INIT_AUTOMAKE([libhttpserver], [0.1.1])
25-
AM_INIT_AUTOMAKE
2625
AC_CONFIG_HEADERS([config.h])
2726
AC_CONFIG_MACRO_DIR([m4])
2827

@@ -80,16 +79,6 @@ AC_ARG_WITH(lua-include-dir,
8079
fi
8180
])
8281

83-
AC_ARG_WITH(lua-lib-dir,
84-
[ --with-lua-lib-dir=DIR where to look for lua libs],
85-
[
86-
lualib=""
87-
if test -d "$withval"
88-
then
89-
lualib="$withval"
90-
fi
91-
])
92-
9382
AC_ARG_WITH([java],
9483
[ --with-java Compile JAVA libraries],
9584
[java=true])
@@ -119,16 +108,23 @@ if test x$python = xtrue; then
119108
then
120109
AC_MSG_ERROR(python-config not found)
121110
fi
122-
CXXFLAGS="$CXXFLAGS `python-config --includes` -DWITH_PYTHON"
123-
LDFLAGS="$LDFLAGS -L`python-config --prefix`/lib"
124-
LIBS="$LIBS `python-config --libs`"
111+
PYINCLUDES="`python-config --includes`"
112+
PYDEFINES="-DWITHPYTHON"
113+
PYLDFLAGS="$LDFLAGS -L`python-config --prefix`/lib"
114+
PYLIBS="$LIBS `python-config --libs`"
115+
AC_SUBST(PYINCLUDES)
116+
AC_SUBST(PYDEFINES)
117+
AC_SUBST(PYLDFLAGS)
118+
AC_SUBST(PYLIBS)
125119
AC_SUBST_FILE([PYTHON_AUTOGENERATION])
126120
PYTHON_AUTOGENERATION=src/autogen_helpers/support_command
127121
LANGUAGES="$LANGUAGES Python"
128122
fi
129123

130124
if test x$java = xtrue; then
131-
125+
JAVAINCLUDES=""
126+
JAVALDFLAGS="$LDFLAGS"
127+
JAVALIBS="$LIBS"
132128
found=""
133129
for loc in $javaloc /usr /usr/local
134130
do
@@ -138,8 +134,7 @@ if test x$java = xtrue; then
138134
AC_MSG_CHECKING([for jni in])
139135
AC_MSG_RESULT($loc)
140136
AC_CHECK_FILE("$loc/include/jni.h",
141-
[CXXFLAGS="$CXXFLAGS -I$loc/include -I$loc/include/linux"; LDFLAGS="$LDFLAGS";
142-
LIBS="$LIBS"; found=1],[])
137+
[JAVAINCLUDES="$CXXFLAGS -I$loc/include -I$loc/include/linux"; found=1],[])
143138

144139
fi
145140

@@ -148,6 +143,9 @@ if test x$java = xtrue; then
148143
then
149144
AC_MSG_ERROR([Unable to find jni headers. Please provide a --with-java-dir=<dir> location])
150145
fi
146+
AC_SUBST(JAVAINCLUDES)
147+
AC_SUBST(JAVALDFLAGS)
148+
AC_SUBST(JABALIBS)
151149
AC_SUBST_FILE([JAVA_AUTOGENERATION])
152150
JAVA_AUTOGENERATION=src/autogen_helpers/support_command
153151
LANGUAGES="$LANGUAGES Java"
@@ -159,14 +157,17 @@ if test x$php = xtrue; then
159157
then
160158
AC_MSG_ERROR(php-config not found)
161159
fi
162-
CXXFLAGS="$CXXFLAGS `php-config --includes`"
163-
LDFLAGS="$LDFLAGS -L`php-config --prefix`/lib"
160+
PHPINCLUDES="`php-config --includes`"
161+
PHPLDFLAGS="$LDFLAGS -L`php-config --prefix`/lib"
162+
AC_SUBST(PHPINCLUDES)
163+
AC_SUBST(PHPLDFLAGS)
164164
AC_SUBST_FILE([PHP_AUTOGENERATION])
165165
PHP_AUTOGENERATION=src/autogen_helpers/support_command
166166
LANGUAGES="$LANGUAGES PHP"
167167
fi
168168

169169
if test x$lua = xtrue; then
170+
LUAINCLUDES=""
170171
found=""
171172
for loc in $luahead /usr/include /usr/local/include
172173
do
@@ -176,7 +177,7 @@ if test x$lua = xtrue; then
176177
AC_MSG_CHECKING([for lua.h in])
177178
AC_MSG_RESULT($loc)
178179
AC_CHECK_FILE("$loc/lua.h",
179-
[CXXFLAGS="$CXXFLAGS -I$loc";
180+
[LUAINCLUDES="$LUACXXFLAGS -I$loc";
180181
found=1],[])
181182

182183
fi
@@ -185,25 +186,7 @@ if test x$lua = xtrue; then
185186
then
186187
AC_MSG_ERROR([Unable to find lua headers. Please provide a --with-lua-include-dir=<dir> location])
187188
fi
188-
189-
found=""
190-
for loc in $lualib /usr/lib /usr/local/lib
191-
do
192-
193-
if test "x$found" = "x"
194-
then
195-
AC_MSG_CHECKING([for liblua.so in])
196-
AC_MSG_RESULT($loc)
197-
AC_CHECK_FILE("$loc/liblua.so",
198-
[LDFLAGS="$LDFLAGS -L$loc";
199-
found=1],[])
200-
201-
fi
202-
done
203-
if test "x$found" = "x"
204-
then
205-
AC_MSG_ERROR([Unable to find lua libs. Please provide a --with-lua-lib-dir=<dir> location])
206-
fi
189+
AC_SUBST(LUAINCLUDES)
207190
AC_SUBST_FILE([LUA_AUTOGENERATION])
208191
LUA_AUTOGENERATION=src/autogen_helpers/support_command
209192
LANGUAGES="$LANGUAGES LUA"
@@ -215,19 +198,40 @@ if test x$perl = xtrue; then
215198
then
216199
AC_MSG_ERROR(perl interpreter not found)
217200
fi
218-
CXXFLAGS="$CXXFLAGS -I`perl -e 'use Config; print $Config{archlib};'`/CORE -Dbool=char"
201+
PERLINCLUDES="$PERLINCLUDES -I`perl -e 'use Config; print $Config{archlib};'`/CORE"
202+
PERLDEFINES="-Dbool=char -D_GNU_SOURCE"
203+
AC_SUBST(PERLINCLUDES)
204+
AC_SUBST(PERLDEFINES)
219205
AC_SUBST_FILE([PERL_AUTOGENERATION])
220206
PERL_AUTOGENERATION=src/autogen_helpers/support_command
221207
LANGUAGES="$LANGUAGES Perl"
222208
fi
223209

224210
if test x$ruby = xtrue; then
225211
AC_CHECK_PROG([RUBYINT],[ruby],["ruby"], ["no"])
212+
RUBYINCLUDES=""
226213
if test "$RUBYINT" = "no"
227214
then
228215
AC_MSG_ERROR(ruby interpreter not found)
229216
fi
230-
CXXFLAGS="$CXXFLAGS -I`ruby -e 'puts $:.join(\" -I\")'`"
217+
found=""
218+
for loc in `ruby -e 'puts $:.join(" ")'`
219+
do
220+
221+
if test "x$found" = "x"
222+
then
223+
AC_MSG_CHECKING([for ruby.h in])
224+
AC_MSG_RESULT($loc)
225+
AC_CHECK_FILE("$loc/ruby.h", [RUBYINCLUDES="$RUBYINCLUDES -I$loc";found=1],[])
226+
fi
227+
done
228+
if test "x$found" = "x"
229+
then
230+
AC_MSG_ERROR([Unable to find ruby headers.])
231+
fi
232+
RUBYDEFINES="-fno-strict-aliasing -D_FILE_OFFSET_BITS=64"
233+
AC_SUBST(RUBYINCLUDES)
234+
AC_SUBST(RUBYDEFINES)
231235
AC_SUBST_FILE([RUBY_AUTOGENERATION])
232236
RUBY_AUTOGENERATION=src/autogen_helpers/support_command
233237
LANGUAGES="$LANGUAGES Ruby"

src/HttpEndpoint.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
1919
*/
20+
#include <regex.h>
2021
#include "HttpEndpoint.hpp"
2122
#include "HttpUtils.hpp"
2223
#include "string_utilities.hpp"

src/Webserver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
1919
*/
20+
#include <stdint.h>
21+
#include <inttypes.h>
2022
#include <iostream>
2123
#include <stdlib.h>
2224
#include <stdio.h>
@@ -30,6 +32,8 @@
3032
#include <Python.h>
3133
#endif
3234

35+
#include <microhttpd.h>
36+
3337
#include "HttpUtils.hpp"
3438
#include "HttpResource.hpp"
3539
#include "HttpResponse.hpp"

src/autogen_helpers/support_command

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
# License along with this library; if not, write to the Free Software
1717
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
#
19-
$(srcdir)/WebserverWrap.cpp $(srcdir)/WebserverWrap.h: $(top_srcdir)/src/Webserver.hpp
20-
swig -c++ -$(language) -o $(srcdir)/WebserverWrap.cpp $(srcdir)/../Webserver.hpp
19+
$(srcdir)/WebserverWrap.cpp $(srcdir)/WebserverWrap.h: $(top_srcdir)/src/httpserver/Webserver.hpp
20+
swig -c++ -$(language) $(swigoptions) -o $(srcdir)/WebserverWrap.cpp -I$(srcdir)/.. $(srcdir)/../httpserver/Webserver.hpp

src/httpserver/Webserver.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,13 @@ namespace std {
167167
%ignore access_log(Webserver*, std::string);
168168
%ignore uri_log(void*, const char*);
169169
%ignore unescaper_func(void*, struct MHD_Connection*, char*);
170-
%ignore internal_unescaper(void*, struct MHD_Connection*, char*);
170+
%ignore internal_unescaper(void*, char*);
171171

172172
%{
173+
#include "HttpUtils.hpp"
174+
#include "HttpRequest.hpp"
175+
#include "HttpResponse.hpp"
176+
#include "HttpEndpoint.hpp"
173177
#include "Webserver.hpp"
174178
%}
175179

@@ -182,11 +186,13 @@ namespace std {
182186
#define DEFAULT_WS_PORT 9898
183187
#define DEFAULT_WS_TIMEOUT 180
184188

189+
#include <stdint.h>
190+
#include <inttypes.h>
185191
#include <sys/types.h>
186192
#include <sys/select.h>
187193
#include <sys/socket.h>
188194
#include <microhttpd.h>
189-
#include <string.h>
195+
#include <cstring>
190196
#include <map>
191197
#include <vector>
192198
#include <string>

src/java/ArgComparator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* ----------------------------------------------------------------------------
22
* This file was automatically generated by SWIG (http://www.swig.org).
3-
* Version 2.0.4
3+
* Version 1.3.40
44
*
55
* Do not make changes to this file unless you know what you are doing--modify
66
* the SWIG interface file instead.
@@ -11,12 +11,12 @@ public class ArgComparator {
1111
private long swigCPtr;
1212
protected boolean swigCMemOwn;
1313

14-
public ArgComparator(long cPtr, boolean cMemoryOwn) {
14+
protected ArgComparator(long cPtr, boolean cMemoryOwn) {
1515
swigCMemOwn = cMemoryOwn;
1616
swigCPtr = cPtr;
1717
}
1818

19-
public static long getCPtr(ArgComparator obj) {
19+
protected static long getCPtr(ArgComparator obj) {
2020
return (obj == null) ? 0 : obj.swigCPtr;
2121
}
2222

@@ -28,14 +28,14 @@ public synchronized void delete() {
2828
if (swigCPtr != 0) {
2929
if (swigCMemOwn) {
3030
swigCMemOwn = false;
31-
libjavawebserver_frameworkJNI.delete_ArgComparator(swigCPtr);
31+
libhttpserver_javaJNI.delete_ArgComparator(swigCPtr);
3232
}
3333
swigCPtr = 0;
3434
}
3535
}
3636

3737
public ArgComparator() {
38-
this(libjavawebserver_frameworkJNI.new_ArgComparator(), true);
38+
this(libhttpserver_javaJNI.new_ArgComparator(), true);
3939
}
4040

4141
}

0 commit comments

Comments
 (0)