Skip to content

Commit 8779ced

Browse files
author
Sebastiano Merlino
committed
Modified in order to allow ruby, lua and perl wrapping
1 parent 10cf8d8 commit 8779ced

File tree

14 files changed

+9675
-4204
lines changed

14 files changed

+9675
-4204
lines changed

Makefile.am

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
# have all needed files, that a GNU package needs
2121
AUTOMAKE_OPTIONS = foreign 1.4
2222

23-
SUBDIRS = src $(PYTHON_DIR) $(JAVA_DIR) $(PHP_DIR)
24-
DIST_SUBDIRS = src $(PYTHON_DIR) $(JAVA_DIR) $(PHP_DIR)
23+
SUBDIRS = src $(PYTHON_DIR) $(JAVA_DIR) $(PHP_DIR) $(LUA_DIR) $(PERL_DIR) $(RUBY_DIR)
24+
DIST_SUBDIRS = src $(PYTHON_DIR) $(JAVA_DIR) $(PHP_DIR) $(LUA_DIR) $(PERL_DIR) $(RUBY_DIR)
2525
EXTRA_DIST = libhttpserver.pc.in
2626

2727
pkgconfigdir = $(libdir)/pkgconfig
@@ -38,3 +38,15 @@ endif
3838
if PHP
3939
PHP_DIR = src/php
4040
endif
41+
42+
if LUA
43+
LUA_DIR = src/lua
44+
endif
45+
46+
if PERL
47+
PERL_DIR = src/perl
48+
endif
49+
50+
if RUBY
51+
RUBY_DIR = src/ruby
52+
endif

configure.ac

Lines changed: 116 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,37 +51,57 @@ AC_TYPE_UINT16_T
5151
LHT_LIBDEPS="-lmicrohttpd"
5252

5353
AC_ARG_WITH([python],
54-
[--with-python Compile PYTHON libraries],
54+
[ --with-python Compile PYTHON libraries],
5555
[python=true])
5656

5757
AC_ARG_WITH([php],
58-
[--with-php Compile PHP libraries],
58+
[ --with-php Compile PHP libraries],
5959
[php=true])
6060

6161
AC_ARG_WITH([ruby],
62-
[--with-ruby Compile RUBY libraries],
62+
[ --with-ruby Compile RUBY libraries],
6363
[ruby=true])
6464

6565
AC_ARG_WITH([perl],
66-
[--with-perl Compile PERL libraries],
66+
[ --with-perl Compile PERL libraries],
6767
[perl=true])
6868

6969
AC_ARG_WITH([lua],
70-
[--with-lua Compile LUA libraries],
70+
[ --with-lua Compile LUA libraries],
7171
[lua=true])
7272

73+
AC_ARG_WITH(lua-include-dir,
74+
[ --with-lua-include-dir=DIR where to look for lua headers],
75+
[
76+
luahead=""
77+
if test -d "$withval"
78+
then
79+
luahead="$withval"
80+
fi
81+
])
82+
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+
7393
AC_ARG_WITH([java],
74-
[--with-java Compile JAVA libraries],
94+
[ --with-java Compile JAVA libraries],
7595
[java=true])
7696

7797
AC_ARG_WITH(java-dir,
78-
[--with-java-dir=DIR where to look for jni headers],
98+
[ --with-java-dir=DIR where to look for jni headers and libs. We search for jni.h in 'java-dir/include/'],
7999
[
80100
javaloc=""
81101
if test -d "$withval"
82102
then
83103
javaloc="$withval"
84-
fi
104+
fi
85105
])
86106

87107
AM_CONDITIONAL([PYTHON], [test x$python = xtrue])
@@ -91,12 +111,20 @@ AM_CONDITIONAL([PERL], [test x$perl = xtrue])
91111
AM_CONDITIONAL([LUA], [test x$lua = xtrue])
92112
AM_CONDITIONAL([RUBY], [test x$ruby = xtrue])
93113

114+
LANGUAGES="C++"
115+
94116
if test x$python = xtrue; then
117+
AC_CHECK_PROG([PYTHONCONFIG],[python-config],["php-config"], ["no"])
118+
if test "$PYTHONCONFIG" = "no"
119+
then
120+
AC_MSG_ERROR(python-config not found)
121+
fi
95122
CXXFLAGS="$CXXFLAGS `python-config --includes` -DWITH_PYTHON"
96-
LDFLAGS+="$LDFLAGS -L`python-config --prefix`/lib"
123+
LDFLAGS="$LDFLAGS -L`python-config --prefix`/lib"
97124
LIBS="$LIBS `python-config --libs`"
98125
AC_SUBST_FILE([PYTHON_AUTOGENERATION])
99126
PYTHON_AUTOGENERATION=src/autogen_helpers/support_command
127+
LANGUAGES="$LANGUAGES Python"
100128
fi
101129

102130
if test x$java = xtrue; then
@@ -120,18 +148,91 @@ if test x$java = xtrue; then
120148
then
121149
AC_MSG_ERROR([Unable to find jni headers. Please provide a --with-java-dir=<dir> location])
122150
fi
123-
AC_SUBST_FILE([JAVA_AUTOGENERATION])
124-
JAVA_AUTOGENERATION=src/autogen_helpers/support_command
151+
AC_SUBST_FILE([JAVA_AUTOGENERATION])
152+
JAVA_AUTOGENERATION=src/autogen_helpers/support_command
153+
LANGUAGES="$LANGUAGES Java"
125154
fi
126155

127156
if test x$php = xtrue; then
157+
AC_CHECK_PROG([PHPCONFIG],[php-config],["php-config"], ["no"])
158+
if test "$PHPCONFIG" = "no"
159+
then
160+
AC_MSG_ERROR(php-config not found)
161+
fi
128162
CXXFLAGS="$CXXFLAGS `php-config --includes`"
129-
LDFLAGS+="$LDFLAGS -L`php-config --prefix`/lib"
130-
# LIBS="$LIBS `php-config --libs`"
163+
LDFLAGS="$LDFLAGS -L`php-config --prefix`/lib"
131164
AC_SUBST_FILE([PHP_AUTOGENERATION])
132165
PHP_AUTOGENERATION=src/autogen_helpers/support_command
166+
LANGUAGES="$LANGUAGES PHP"
133167
fi
134168

169+
if test x$lua = xtrue; then
170+
found=""
171+
for loc in $luahead /usr/include /usr/local/include
172+
do
173+
174+
if test "x$found" = "x"
175+
then
176+
AC_MSG_CHECKING([for lua.h in])
177+
AC_MSG_RESULT($loc)
178+
AC_CHECK_FILE("$loc/lua.h",
179+
[CXXFLAGS="$CXXFLAGS -I$loc";
180+
found=1],[])
181+
182+
fi
183+
done
184+
if test "x$found" = "x"
185+
then
186+
AC_MSG_ERROR([Unable to find lua headers. Please provide a --with-lua-include-dir=<dir> location])
187+
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
207+
AC_SUBST_FILE([LUA_AUTOGENERATION])
208+
LUA_AUTOGENERATION=src/autogen_helpers/support_command
209+
LANGUAGES="$LANGUAGES LUA"
210+
fi
211+
212+
if test x$perl = xtrue; then
213+
AC_CHECK_PROG([PERLINT],[perl],["perl"], ["no"])
214+
if test "$PERLINT" = "no"
215+
then
216+
AC_MSG_ERROR(perl interpreter not found)
217+
fi
218+
CXXFLAGS="$CXXFLAGS -I`perl -e 'use Config; print $Config{archlib};'`/CORE -Dbool=char"
219+
AC_SUBST_FILE([PERL_AUTOGENERATION])
220+
PERL_AUTOGENERATION=src/autogen_helpers/support_command
221+
LANGUAGES="$LANGUAGES Perl"
222+
fi
223+
224+
if test x$ruby = xtrue; then
225+
AC_CHECK_PROG([RUBYINT],[ruby],["ruby"], ["no"])
226+
if test "$RUBYINT" = "no"
227+
then
228+
AC_MSG_ERROR(ruby interpreter not found)
229+
fi
230+
CXXFLAGS="$CXXFLAGS -I`ruby -e 'puts $:.join(\" -I\")'`"
231+
AC_SUBST_FILE([RUBY_AUTOGENERATION])
232+
RUBY_AUTOGENERATION=src/autogen_helpers/support_command
233+
LANGUAGES="$LANGUAGES Ruby"
234+
fi
235+
135236
AC_SUBST(LHT_LIBDEPS)
136237
AC_SUBST(CPPFLAGS)
137238
AC_SUBST(LIBS)
@@ -140,11 +241,12 @@ AC_SUBST(EXT_LIB_PATH)
140241
AC_SUBST(EXT_LIBS)
141242

142243
AC_OUTPUT(
143-
libhttpserver.pc Makefile src/Makefile src/python/Makefile src/php/Makefile src/java/Makefile src/perl/Makefile src/ruby/Makefile src/lua/Makefile
244+
libhttpserver.pc Makefile src/Makefile src/python/Makefile src/java/Makefile src/php/Makefile src/lua/Makefile src/perl/Makefile src/ruby/Makefile
144245
)
145246

146247
AC_MSG_NOTICE([Configuration Summary:
147248
Operating System: ${host_os}
148249
Target directory: ${prefix}
149250
License : LGPL only
251+
Languages : ${LANGUAGES}
150252
])

libhttpserver.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ includedir=@includedir@
66
Name: libhttpserver
77
Description: A C++ library for creating an embedded Rest HTTP server
88
Version: @VERSION@
9-
Requires: libhttpserver >= 0.9.9
9+
Requires: libmicrohttpd >= 0.9.9
1010
Conflicts:
11-
Libs: -L${libdir} -lhttpserver
11+
Libs: -L${libdir} -lmicrohttpd
1212
Libs.private: @LHT_LIBDEPS@
1313
Cflags: -I${includedir}

0 commit comments

Comments
 (0)