[msgbus commit] r120 - in trunk: . python src

1 view
Skip to first unread message

codesite...@google.com

unread,
Sep 7, 2008, 2:09:30 AM9/7/08
to msgbu...@googlegroups.com
Author: dugsong
Date: Sat Sep 6 23:09:02 2008
New Revision: 120

Added:
trunk/python/setup.py.in (contents, props changed)
Removed:
trunk/python/setup.py
Modified:
trunk/Makefile.am
trunk/configure.ac
trunk/python/Makefile.am
trunk/src/Makefile.am

Log:
support --with-libevent, fix python build, support 'dist' target

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am (original)
+++ trunk/Makefile.am Sat Sep 6 23:09:02 2008
@@ -1,3 +1,7 @@
SUBDIRS = src python
+
+EXTRA_DIST = LICENSE
+
CLEANFILES = stamp-h
-AUTOMAKE_OPTIONS = foreign
+
+AUTOMAKE_OPTIONS = foreign no-dependencies

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sat Sep 6 23:09:02 2008
@@ -2,50 +2,52 @@
AC_CONFIG_SRCDIR(src/msgbus.c)
AC_PREREQ(2.59)
AM_INIT_AUTOMAKE
-AC_CONFIG_HEADERS(config.h)
+AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_HEADER_STDC
AM_PROG_LIBTOOL
-AC_CANONICAL_HOST
+AM_PATH_PYTHON
+AM_CONDITIONAL(HAVE_PYTHON, [test "x$PYTHON" != "x"])
AC_REPLACE_FUNCS(strlcat strlcpy)

-case "$host" in
- *linux*)
- OS="linux"
- AC_DEFINE(OS_LINUX, 1, [compiling under linux])
- ;;
- *cygwin* | *mingw*)
- OS="win32"
- CFLAGS="$CFLAGS -mno-cygwin"
- LDFLAGS="$LDFLAGS --strip-all"
- AC_DEFINE(OS_WIN32, 1, [compiling under windows])
- AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [fast code generation])
- ;;
- *darwin* | *macos10*)
- OS="bsd"
- if test -d /opt/local ; then
- PATH="/opt/local/bin:$PATH"
- CFLAGS="$CFLAGS -I/opt/local/include"
- LDFLAGS="$LDFLAGS -L/opt/local/lib"
- elif test -d /sw ; then
- PATH="/sw/bin:$PATH"
- CFLAGS="$CFLAGS -I/sw/include"
- LDFLAGS="$LDFLAGS -L/sw/lib"
- fi
- AC_DEFINE(OS_BSD, 1, [compiling under bsd])
- AC_DEFINE(BIND_8_COMPAT, 1, [enable bind8 compatibility])
- ;;
- *bsd*)
- OS="bsd"
- AC_DEFINE(OS_BSD, 1, [compiling under bsd])
- ;;
+# Checks for libevent
+AC_MSG_CHECKING(for libevent)
+AC_ARG_WITH(libevent,
+[ --with-libevent=DIR use libevent in DIR],
+[ case "$withval" in
+ yes|no)
+ AC_MSG_RESULT(no)
+ ;;
*)
- OS="bsd"
- AC_DEFINE(OS_BSD, 1, [compiling under unknown, assuming BSD])
- ;;
-esac
+ AC_MSG_RESULT($withval)
+ if test -f $withval/include/event.h -a -f $withval/lib/libevent.a;
then
+ owd=`pwd`
+ if cd $withval; then withval=`pwd`; cd $owd; fi
+ EVENTINC="-I$withval/include"
+ EVENTLIB="-L$withval/lib -levent"
+ elif test -f $withval/event.h -a -f $withval/libevent.a; then
+ owd=`pwd`
+ if cd $withval; then withval=`pwd`; cd $owd; fi
+ EVENTINC="-I$withval"
+ EVENTLIB="-L$withval -levent"
+ else
+ AC_ERROR(event.h or libevent.a not found in $withval)
+ fi
+ ;;
+ esac ],
+[ if test -f /usr/include/event.h -a -f /usr/lib/libevent.a; then
+ EVENTLIB="-levent"
+ elif test -f ${prefix}/include/event.h -a -f ${prefix}/lib/libevent.a;
then
+ EVENTINC="-I${prefix}/include"
+ EVENTLIB="-L${prefix}/lib -levent"
+ else
+ AC_MSG_RESULT(no)
+ AC_ERROR(libevent not found)
+ fi
+ AC_MSG_RESULT(yes) ]
+)
+AC_SUBST(EVENTINC)
+AC_SUBST(EVENTLIB)

-AC_SUBST(OS)
-
-AC_OUTPUT([Makefile src/Makefile python/Makefile])
+AC_OUTPUT([Makefile src/Makefile python/Makefile python/setup.py])

Modified: trunk/python/Makefile.am
==============================================================================
--- trunk/python/Makefile.am (original)
+++ trunk/python/Makefile.am Sat Sep 6 23:09:02 2008
@@ -1,10 +1,14 @@
+
+if HAVE_PYTHON
+# XXX - nasty automake fudging here...
+
noinst_SCRIPTS = python-build

$(srcdir)/evmsg.c: $(srcdir)/evmsg.pyx
cython $(srcdir)/evmsg.pyx

python-build: $(srcdir)/evmsg.c
- python setup.py build
+ $(PYTHON) setup.py build
touch python-build

python-clean:
@@ -15,8 +19,16 @@
distclean: clean

python-install:
- python setup.py install --prefix=$(DESTDIR)$(prefix)
+ $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix)

install-exec-local: python-install
+
+else
+
+install-exec-local:
+
+endif
+
+EXTRA_DIST = evmsg.pyx evmsg.c setup.py.in msgchat.py msgdump.py
msgdump2.py msgsend.py

DISTCLEANFILES = *~

Added: trunk/python/setup.py.in
==============================================================================
--- (empty file)
+++ trunk/python/setup.py.in Sat Sep 6 23:09:02 2008
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+from distutils.core import setup, Extension
+
+evmsg = Extension(name='evmsg',
+ sources=[ 'evmsg.c' ],
+ include_dirs=[ '..', '../src', '@EVENTINC@'[2:] ],
+
library_dirs=[ '../src', '../src/.libs', '@EVENTLIB@'.split()[0][2:] ],
+ libraries=[ 'event', 'evmsg' ]
+ )
+
+setup(name='evmsg',
+ version='@VERSION@',
+ author='Dug Song',
+ author_email='dug...@monkey.org',
+ description='msgbus event library',
+ ext_modules = [ evmsg ])

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Sat Sep 6 23:09:02 2008
@@ -1,15 +1,19 @@
+INCLUDES = @EVENTINC@
+
lib_LTLIBRARIES = libevmsg.la

-libevmsg_la_SOURCES = evmsg.c
-libevmsg_la_LIBADD = @LTLIBOBJS@ -levent_core -levent_extra
+libevmsg_la_SOURCES = evmsg.h evmsg.c
+libevmsg_la_LIBADD = @LTLIBOBJS@ @EVENTLIB@

bin_PROGRAMS = msgbus test-pub test-sub

-msgbus_SOURCES = msgbus.c match.c mimetype.c
-msgbus_LDADD = libevmsg.la -levent_core -levent_extra
+msgbus_SOURCES = msgbus.c match.h match.c mimetype.h mimetype.c
+msgbus_LDADD = libevmsg.la @EVENTLIB@

test_pub_SOURCES = test-pub.c
-test_pub_LDADD = libevmsg.la -levent_core -levent_extra
+test_pub_LDADD = libevmsg.la @EVENTLIB@

test_sub_SOURCES = test-sub.c
-test_sub_LDADD = libevmsg.la -levent_core -levent_extra
+test_sub_LDADD = libevmsg.la @EVENTLIB@
+
+EXTRA_DIST = sys/queue.h sys/tree.h

Reply all
Reply to author
Forward
0 new messages