Hi Folks,

Please find a patch to add pkgconfig support below.  This was diffed
against trunk as of today (April 16, 2009), but probably could be
applied to the stable series pretty simply.  This should work across a
variety of platforms as it does not link against libraries
unnecessarily.

Please enjoy responsibly.

Index: configure.in
===================================================================
--- configure.in        (revision 1176)
+++ configure.in        (working copy)
@@ -40,10 +40,10 @@
 AC_SUBST(LIBTOOL_DEPS)
 
 dnl Checks for libraries.
-AC_CHECK_LIB(socket, socket)
-AC_CHECK_LIB(resolv, inet_aton)
-AC_CHECK_LIB(rt, clock_gettime)
-AC_CHECK_LIB(nsl, inet_ntoa)
+AC_CHECK_LIB(socket, socket, [AC_SUBST( [LIBSOCKET], ["-lsocket"] )] )
+AC_CHECK_LIB(resolv, inet_aton, [AC_SUBST( [LIBRESOLV],
["-lresolv"] )]  )
+AC_CHECK_LIB(rt, clock_gettime, [AC_SUBST( [LIBRT], ["-lrt"] )] )
+AC_CHECK_LIB(nsl, inet_ntoa, [AC_SUBST( [LIBNSL], ["-lnsl"] )] )
 
 dnl Determine if we have zlib for regression tests
 ZLIB_LIBS=""
@@ -453,4 +453,5 @@
 
 fi
 
+AC_CONFIG_FILES( [libevent.pc] )
 AC_OUTPUT(Makefile include/Makefile test/Makefile sample/Makefile)
Index: libevent.pc.in
===================================================================
--- libevent.pc.in      (revision 0)
+++ libevent.pc.in      (revision 0)
@@ -0,0 +1,15 @@
+#libevent pkg-config source file
+
+pref...@prefix@
+exec_pref...@exec_prefix@
+libd...@libdir@
+included...@includedir@
+
+Name: libevent
+Description: libevent is an asynchronous notification event loop
library
+Version: @VERSION@
+Requires:
+Conflicts:
+Libs: -L${libdir} -levent @LIBSOCKET@ @LIBRESOLV@ @LIBRT@ @LIBNSL@
@ZLIB_LIBS@
+Cflags: -I${includedir}
+
Index: Makefile.am
===================================================================
--- Makefile.am (revision 1176)
+++ Makefile.am (working copy)
@@ -29,9 +29,13 @@
 
 bin_SCRIPTS = event_rpcgen.py
 
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA=libevent.pc
+
 EXTRA_DIST = \
        autogen.sh evdns.3 \
        event.3 \
+       libevent.pc \
        Doxyfile \
        kqueue.c epoll_sub.c epoll.c select.c poll.c signal.c \
        evport.c devpoll.c event_rpcgen.py \
@@ -131,4 +135,4 @@
        doxygen $(srcdir)/Doxyfile
 FORCE:
 
-DISTCLEANFILES = *~ event-config.h
+DISTCLEANFILES = *~ event-config.h libevent.pc

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to