]> granicus.if.org Git - libevent/commitdiff
Switch to using AM conditionals in place of AC_LIBOBJ
authorNick Mathewson <nickm@torproject.org>
Fri, 12 Mar 2010 19:16:30 +0000 (14:16 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 12 Mar 2010 19:16:30 +0000 (14:16 -0500)
AC_LIBOBJ is really only meant for defining missing library functions,
not conditional code compilation.  Sticking our conditionally compiled
modules in SYS_SRC should make stuff easier to maintain.

Makefile.am
configure.in

index 6679f0e6c3f261306b9af6fb1f6a1344ae2e6725..f285d39f07a1c1554d6555d098f23941f2730774 100644 (file)
@@ -37,17 +37,16 @@ bin_SCRIPTS = event_rpcgen.py
 pkgconfigdir=$(libdir)/pkgconfig
 pkgconfig_DATA=libevent.pc
 
-# These sources are conditionally added to SYS_SRC by configure.in
+# These sources are conditionally added by configure.in or conditionally
+# included from other files.
 PLATFORM_DEPENDENT_SRC = \
-       kqueue.c epoll_sub.c epoll.c select.c poll.c signal.c \
-       evport.c devpoll.c
-       arc4random.c \
-       evthread_pthread.c
+       epoll_sub.c \
+       arc4random.c
 
 EXTRA_DIST = \
        evdns.3 event.3 \
        LICENSE \
-       autogen.sh
+       autogen.sh \
        libevent.pc.in \
        Doxyfile \
        whatsnew-2.0.txt \
@@ -80,6 +79,28 @@ SYS_INCLUDES =
 
 endif
 
+if SELECT_BACKEND
+SYS_SRC += select.c
+endif
+if POLL_BACKEND
+SYS_SRC += poll.c
+endif
+if DEVPOLL_BACKEND
+SYS_SRC += devpoll.c
+endif
+if KQUEUE_BACKEND
+SYS_SRC += kqueue.c
+endif
+if EPOLL_BACKEND
+SYS_SRC += epoll.c
+endif
+if EVPORT_BACKEND
+SYS_SRC += evport.c
+endif
+if SIGNAL_SUPPORT
+SYS_SRC += signal.c
+endif
+
 BUILT_SOURCES = event-config.h
 
 event-config.h: config.h
@@ -106,7 +127,6 @@ CORE_SRC = event.c evthread.c buffer.c \
        evmap.c log.c evutil.c evutil_rand.c strlcpy.c $(SYS_SRC)
 EXTRA_SRC = event_tagging.c http.c evdns.c evrpc.c
 
-
 libevent_la_SOURCES = $(CORE_SRC) $(EXTRA_SRC)
 libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS)
 libevent_la_LDFLAGS = -version-info $(VERSION_INFO)
index 2aeab1ec21c87d5e2ef0adbadd53af2b1084fed3..269f6cdc2adeab5c14f1c70851572710a587c175 100644 (file)
@@ -260,32 +260,23 @@ needsignal=no
 haveselect=no
 AC_CHECK_FUNCS(select, [haveselect=yes], )
 if test "x$haveselect" = "xyes" ; then
-       AC_LIBOBJ(select)
        needsignal=yes
 fi
+AM_CONDITIONAL(SELECT_BACKEND, [test "x$haveselect" = "xyes"])
 
 havepoll=no
 AC_CHECK_FUNCS(poll, [havepoll=yes], )
 if test "x$havepoll" = "xyes" ; then
-       AC_LIBOBJ(poll)
-       needsignal=yes
-fi
-
-haveepoll=no
-AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
-if test "x$haveepoll" = "xyes" ; then
-       AC_DEFINE(HAVE_EPOLL, 1,
-               [Define if your system supports the epoll system calls])
-       AC_LIBOBJ(epoll)
        needsignal=yes
 fi
+AM_CONDITIONAL(POLL_BACKEND, [test "x$havepoll" = "xyes"])
 
 havedevpoll=no
 if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then
        AC_DEFINE(HAVE_DEVPOLL, 1,
                    [Define if /dev/poll is available])
-        AC_LIBOBJ(devpoll)
 fi
+AM_CONDITIONAL(DEVPOLL_BACKEND, [test "ac_cv_header_sys_devpoll_h" = "xyes"])
 
 havekqueue=no
 if test "x$ac_cv_header_sys_event_h" = "xyes"; then
@@ -340,11 +331,20 @@ main(int argc, char **argv)
 }, [AC_MSG_RESULT(yes)
     AC_DEFINE(HAVE_WORKING_KQUEUE, 1,
                [Define if kqueue works correctly with pipes])
-    AC_LIBOBJ(kqueue)], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
+    havekqueue=yes
+    ], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
        fi
 fi
+AM_CONDITIONAL(KQUEUE_BACKEND, [test "x$havekqueue" = "xyes"])
 
 haveepollsyscall=no
+haveepoll=no
+AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
+if test "x$haveepoll" = "xyes" ; then
+       AC_DEFINE(HAVE_EPOLL, 1,
+               [Define if your system supports the epoll system calls])
+       needsignal=yes
+fi
 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
        if test "x$haveepoll" = "xno" ; then
                AC_MSG_CHECKING(for epoll system call)
@@ -373,28 +373,27 @@ main(int argc, char **argv)
     AC_DEFINE(HAVE_EPOLL, 1,
        [Define if your system supports the epoll system calls])
     needsignal=yes
+    have_epoll=yes
     AC_LIBOBJ(epoll_sub)
-    AC_LIBOBJ(epoll)], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
+    ], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
        fi
 fi
+AM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"])
 
 haveeventports=no
 AC_CHECK_FUNCS(port_create, [haveeventports=yes], )
 if test "x$haveeventports" = "xyes" ; then
        AC_DEFINE(HAVE_EVENT_PORTS, 1,
                [Define if your system supports event ports])
-       AC_LIBOBJ(evport)
-       needsignal=yes
-fi
-if test "x$bwin32" = "xtrue"; then
        needsignal=yes
 fi
+AM_CONDITIONAL(EVPORT_BACKEND, [test "x$haveeventports" = "xyes"])
+
 if test "x$bwin32" = "xtrue"; then
        needsignal=yes
 fi
-if test "x$needsignal" = "xyes" ; then
-       AC_LIBOBJ(signal)
-fi
+
+AM_CONDITIONAL(SIGNAL_SUPPORT, [test "x$needsignal" = "xyes"])
 
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T