Add mruby as submodule; disable mruby by default for now

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-05 17:49:10 +09:00
parent 4ac7152f94
commit aba7e9e7f9
5 changed files with 39 additions and 28 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "third-party/mruby"]
path = third-party/mruby
url = https://github.com/mruby/mruby

View File

@ -121,8 +121,8 @@ AC_ARG_WITH([spdylay],
AC_ARG_WITH([mruby],
[AS_HELP_STRING([--with-mruby],
[Use mruby [default=check]])],
[request_mruby=$withval], [request_mruby=check])
[Use mruby [default=no]])],
[request_mruby=$withval], [request_mruby=no])
AC_ARG_WITH([cython],
[AS_HELP_STRING([--with-cython=PATH],
@ -376,29 +376,15 @@ fi
AM_CONDITIONAL([HAVE_SPDYLAY], [ test "x${have_spdylay}" = "xyes" ])
# mruby (for src/nghttpx)
AC_LANG_PUSH(C++)
LIBS_OLD=$LIBS
have_mruby=no
if test "x${request_mruby}" != "xno"; then
AC_CHECK_LIB([mruby], [mrb_open], [have_mruby=yes], [have_mruby=no], [-lm])
if test "x${have_mruby}" = "xyes"; then
AC_CHECK_HEADER([mruby.h], [have_mruby=yes], [have_mruby=no])
if test "x${have_mruby}" = "xyes"; then
if test "x${request_mruby}" = "xyes"; then
# We are going to build mruby
have_mruby=yes
AC_DEFINE([HAVE_MRUBY], [1], [Define to 1 if you have `mruby` library.])
LIBMRUBY_LIBS="-lmruby -lm"
LIBMRUBY_CFLAGS=
AC_SUBST([LIBMRUBY_LIBS])
AC_SUBST([LIBMRUBY_CFLAGS])
fi
fi
fi
LIBS=$LIBS_OLD
AC_LANG_POP()
if test "x${request_mruby}" = "xyes" &&
test "x${have_mruby}" != "xyes"; then
AC_MSG_ERROR([mruby was requested (--with-mruby) but not found])
fi
AM_CONDITIONAL([HAVE_MRUBY], [test "x${have_mruby}" = "xyes"])

View File

@ -141,10 +141,13 @@ endif # HAVE_MRUBY
noinst_LIBRARIES = libnghttpx.a
libnghttpx_a_SOURCES = ${NGHTTPX_SRCS}
libnghttpx_a_CPPFLAGS = ${AM_CPPFLAGS} \
-I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@
nghttpx_SOURCES = shrpx.cc shrpx.h
nghttpx_CPPFLAGS = ${AM_CPPFLAGS} @LIBMRUBY_CFLAGS@
nghttpx_LDADD = libnghttpx.a ${LDADD} @LIBMRUBY_LIBS@
nghttpx_CPPFLAGS = ${libnghttpx_a_CPPFLAGS}
nghttpx_LDADD = libnghttpx.a ${LDADD} \
-L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@
if HAVE_CUNIT
check_PROGRAMS += nghttpx-unittest
@ -158,10 +161,12 @@ nghttpx_unittest_SOURCES = shrpx-unittest.cc \
nghttp2_gzip.c nghttp2_gzip.h \
buffer_test.cc buffer_test.h \
memchunk_test.cc memchunk_test.h
nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS} @LIBMRUBY_CFLAGS@ \
nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS} \
-I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@ \
-DNGHTTP2_TESTS_DIR=\"$(top_srcdir)/tests\"
nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} \
@LIBMRUBY_LIBS@ @CUNIT_LIBS@ @TESTLDADD@
-L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@ \
@CUNIT_LIBS@ @TESTLDADD@
TESTS += nghttpx-unittest
endif # HAVE_CUNIT

View File

@ -30,5 +30,21 @@ libhttp_parser_la_SOURCES = \
http-parser/http_parser.c \
http-parser/http_parser.h
.PHONY: all-local clean mruby
if HAVE_MRUBY
mruby:
git submodule update --init
MRUBY_CONFIG=${srcdir}/build_config.rb \
BUILD_DIR=${abs_builddir}/mruby/build \
${srcdir}/mruby/minirake -f ${srcdir}/mruby/Rakefile
all-local: mruby
clean-local:
-rm -rf ${abs_builddir}/mruby/build
endif # HAVE_MRUBY
endif # ENABLE_THIRD_PARTY

1
third-party/mruby vendored Submodule

@ -0,0 +1 @@
Subproject commit 1cbbb7e11c02d381a6b76aeebae8db0f54ae9baf