null+****@clear*****
null+****@clear*****
2010年 12月 9日 (木) 19:04:03 JST
Kouhei Sutou 2010-12-09 10:04:03 +0000 (Thu, 09 Dec 2010)
New Revision: c396af368eca14e396f6b6e83e70348c4ed4a0c6
Log:
support 'make install' of suggest learner. #767
Added files:
src/suggest/Makefile.am
Removed files:
src/suggest/Makefile
Modified files:
.gitignore
configure.ac
src/Makefile.am
Renamed files:
src/suggest/groonga_suggest_httpd.c
(from src/suggest/suggest-httpd.c)
src/suggest/groonga_suggest_learner.c
(from src/suggest/suggest-learner.c)
Modified: .gitignore (+2 -0)
===================================================================
--- .gitignore 2010-12-08 05:43:01 +0000 (68b99b6)
+++ .gitignore 2010-12-09 10:04:03 +0000 (55db794)
@@ -79,3 +79,5 @@ version.sh
/examples/dictionary/*.gz
/examples/dictionary/gene95-dictionary/
/misc/
+/src/suggest/groonga-suggest-httpd
+/src/suggest/groonga-suggest-learner
Modified: configure.ac (+110 -0)
===================================================================
--- configure.ac 2010-12-08 05:43:01 +0000 (ff0795d)
+++ configure.ac 2010-12-09 10:04:03 +0000 (f5aa5c5)
@@ -88,6 +88,7 @@ m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
AC_CONFIG_FILES([Makefile
src/Makefile
+ src/suggest/Makefile
lib/Makefile
include/Makefile
include/groonga/Makefile
@@ -620,6 +621,115 @@ fi
AC_MSG_CHECKING([whether enable futex])
AC_MSG_RESULT($enable_futex)
+# ZeroMQ
+AC_ARG_ENABLE(zeromq,
+ [AS_HELP_STRING([--disable-zeromq],
+ [use ZeroMQ for suggestion. [default=auto-detect]])],
+ [enable_zeromq="$enableval"],
+ [enable_zeromq="auto"])
+if test "x$enable_zeromq" != "xno"; then
+ m4_ifdef([PKG_CHECK_MODULES], [
+ PKG_CHECK_MODULES([LIBZMQ],
+ [libzmq],
+ [zeromq_available=yes],
+ [zeromq_available=no])
+ ],
+ [zeromq_available=no])
+ if test "x$zeromq_available" = "xyes"; then
+ AC_DEFINE(HAVE_ZEROMQ, [1], [Define to 1 if ZeroMQ is available.])
+ else
+ if test "x$enable_zeromq" = "xyes"; then
+ AC_MSG_ERROR("No ZeroMQ found")
+ fi
+ fi
+fi
+
+# ZeroMQ
+AC_ARG_ENABLE(zeromq,
+ [AS_HELP_STRING([--disable-zeromq],
+ [Disable ZeroMQ used for suggestion. [default=auto-detect]])],
+ [enable_zeromq="$enableval"],
+ [enable_zeromq="auto"])
+if test "x$enable_zeromq" != "xno"; then
+ m4_ifdef([PKG_CHECK_MODULES], [
+ PKG_CHECK_MODULES([LIBZMQ],
+ [libzmq],
+ [zeromq_available=yes],
+ [zeromq_available=no])
+ ],
+ [zeromq_available=no])
+ if test "x$zeromq_available" = "xyes"; then
+ AC_DEFINE(HAVE_ZEROMQ, [1], [Define to 1 if ZeroMQ is available.])
+ else
+ if test "x$enable_zeromq" = "xyes"; then
+ AC_MSG_ERROR("No ZeroMQ found")
+ fi
+ fi
+fi
+
+# libevent
+AC_ARG_WITH(libevent,
+ [AS_HELP_STRING([--without-libevent],
+ [Disable libevent used for suggestion. [default=/usr]])],
+ [with_libevent="$withval"],
+ [with_libevent="/usr"])
+if test "x$enable_libevent" != "xno"; then
+ _SAVE_CFLAGS="$CFLAGS"
+ _SAVE_LDFLAGS="$LDFLAGS"
+ CFLAGS="$CFLAGS -I$with_libevent/include"
+ LDFLAGS="$LDFLAGS -L$with_libevent/lib"
+ AC_CHECK_LIB(event, event_init,
+ [libevent_available=yes],
+ [libevent_available=no])
+ CFLAGS="$_SAVE_CFLAGS"
+ LDFLAGS="$_SAVE_LDFLAGS"
+ if test "x$libevent_available" = "xyes"; then
+ AC_DEFINE(HAVE_LIBEVENT, [1], [Define to 1 if libevent is available.])
+ LIBEVENT_CFLAGS="-I$with_libevent/include"
+ LIBEVENT_LIBS="-L$with_libevent/lib -levent"
+ else
+ if test "x$with_libevent" = "xyes"; then
+ AC_MSG_ERROR("No libevent found")
+ fi
+ fi
+fi
+AC_SUBST(LIBEVENT_CFLAGS)
+AC_SUBST(LIBEVENT_LIBS)
+
+# MessagePack
+AC_ARG_WITH(message-pack,
+ [AS_HELP_STRING([--without-message-pack],
+ [Disable MessagePack used for suggestion. [default=/usr]])],
+ [with_message_pack="$withval"],
+ [with_message_pack="/usr"])
+if test "x$enable_message_pack" != "xno"; then
+ _SAVE_CFLAGS="$CFLAGS"
+ _SAVE_LDFLAGS="$LDFLAGS"
+ CFLAGS="$CFLAGS -I$with_message_pack/include"
+ LDFLAGS="$LDFLAGS -L$with_message_pack/lib"
+ AC_CHECK_LIB(event, event_init,
+ [message_pack_available=yes],
+ [message_pack_available=no])
+ CFLAGS="$_SAVE_CFLAGS"
+ LDFLAGS="$_SAVE_LDFLAGS"
+ if test "x$message_pack_available" = "xyes"; then
+ AC_DEFINE(HAVE_MESSAGE_PACK, [1], [Define to 1 if MessagePack is available.])
+ MESSAGE_PACK_CFLAGS="-I$with_message_pack/include"
+ MESSAGE_PACK_LIBS="-L$with_message_pack/lib -lmsgpack"
+ else
+ if test "x$with_message_pack" = "xyes"; then
+ AC_MSG_ERROR("No MessagePack found")
+ fi
+ fi
+fi
+AC_SUBST(MESSAGE_PACK_CFLAGS)
+AC_SUBST(MESSAGE_PACK_LIBS)
+
+AM_CONDITIONAL([ENABLE_SUGGEST_LEARNER],
+ [test "$zeromq_available" = "yes" -a \
+ "$libevent_available" = "yes" -a \
+ "$message_pack_available" = "yes"])
+
# check sphinx-build for documentation
ac_sphinx_available="no"
sphinx_required_version="1.0.1"
Modified: src/Makefile.am (+2 -0)
===================================================================
--- src/Makefile.am 2010-12-08 05:43:01 +0000 (9a29449)
+++ src/Makefile.am 2010-12-09 10:04:03 +0000 (ab6adb8)
@@ -1,3 +1,5 @@
+SUBDIRS = suggest
+
bin_PROGRAMS = groonga grntest
noinst_PROGRAMS = grnslap
Deleted: src/suggest/Makefile (+0 -10) 100644
===================================================================
--- src/suggest/Makefile 2010-12-08 05:43:01 +0000 (ab72182)
+++ /dev/null
@@ -1,10 +0,0 @@
-all: suggest-learner suggest-httpd
-
-suggest-httpd: suggest-httpd.c util.c
- gcc -O3 -ggdb -Wall -o suggest-httpd suggest-httpd.c util.c -lzmq -levent -lmsgpack -lgroonga
-
-suggest-learner: suggest-learner.c util.c
- gcc -O3 -ggdb -Wall -o suggest-learner suggest-learner.c util.c -lzmq -lmsgpack -lgroonga
-
-clean:
- rm suggest-httpd suggest-learner
Added: src/suggest/Makefile.am (+41 -0) 100644
===================================================================
--- /dev/null
+++ src/suggest/Makefile.am 2010-12-09 10:04:03 +0000 (b64e7a6)
@@ -0,0 +1,41 @@
+if ENABLE_SUGGEST_LEARNER
+bin_PROGRAMS = groonga-suggest-learner groonga-suggest-httpd
+noinst_LTLIBRARIES = libutil.la
+endif
+
+AM_CFLAGS = -fno-strict-aliasing $(COVERAGE_CFLAGS) $(GRN_CFLAGS)
+DEFS += $(GRN_DEFS)
+
+AM_LDFLAGS = -no-undefined
+
+DEFAULT_INCLUDES = \
+ -I$(top_builddir) \
+ -I$(srcdir) \
+ -I$(top_srcdir)/include \
+ $(GROONGA_INCLUDEDIR)
+
+groonga_suggest_learner_SOURCES = groonga_suggest_learner.c
+groonga_suggest_learner_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(LIBZMQ_CFLAGS) \
+ $(MESSAGE_PACK_CFLAGS)
+groonga_suggest_learner_LDADD = \
+ libutil.la \
+ $(top_builddir)/lib/libgroonga.la \
+ $(LIBZMQ_LIBS) \
+ $(MESSAGE_PACK_LIBS)
+
+groonga_suggest_httpd_SOURCES = groonga_suggest_httpd.c
+groonga_suggest_httpd_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(LIBEVENT_CFLAGS) \
+ $(LIBZMQ_CFLAGS) \
+ $(MESSAGE_PACK_CFLAGS)
+groonga_suggest_httpd_LDADD = \
+ libutil.la \
+ $(top_builddir)/lib/libgroonga.la \
+ $(LIBEVENT_LIBS) \
+ $(LIBZMQ_LIBS) \
+ $(MESSAGE_PACK_LIBS)
+
+libutil_la_SOURCES = util.c
Renamed: src/suggest/groonga_suggest_httpd.c (+0 -0) 100%
===================================================================
Renamed: src/suggest/groonga_suggest_learner.c (+0 -0) 100%
===================================================================