diff mbox

Separate event loop implementation by specific macros

Message ID 20140413211608.GA5067@w1.fi
State Not Applicable
Headers show

Commit Message

Jouni Malinen April 13, 2014, 9:16 p.m. UTC
On Wed, Apr 02, 2014 at 06:52:32PM +0900, Masashi Honma wrote:
> I modified my patch to use CONFIG_ELOOP=eloop_win.
> I hope I understood what you want :).

Close, but I wanted to switch it the other way around, i.e., the
CONFIG_ELOOP=<arbitrary name> should work for all other cases than
eloop.c and not just that eloop_win.c (i.e., for any version that is not
included in this repository as well). In addition, CONFIG_ELOOP_POLL=y
should remain to work like it used to work before.

This shows a modified example with wpa_supplicant/Makefile:
diff mbox

Patch

diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 19dae70..58d2d46 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -122,22 +122,33 @@  endif
 endif
 
 ifndef CONFIG_ELOOP
-CONFIG_ELOOP=eloop
+ifdef CONFIG_ELOOP_POLL
+CONFIG_ELOOP=poll
+else
+CONFIG_ELOOP=select
+endif
+endif
+
+ifeq ($(CONFIG_ELOOP), select)
+CFLAGS += -DCONFIG_ELOOP_SELECT
+ELOOP_SHARED=y
+endif
+ifeq ($(CONFIG_ELOOP), poll)
+CFLAGS += -DCONFIG_ELOOP_POLL
+ELOOP_SHARED=y
 endif
-OBJS += ../src/utils/$(CONFIG_ELOOP).o
-OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
 
-ifeq ($(CONFIG_ELOOP), eloop)
+ifdef ELOOP_SHARED
 # Using glibc < 2.17 requires -lrt for clock_gettime()
 LIBS += -lrt
 LIBS_c += -lrt
 LIBS_p += -lrt
+ELOOP_FILE=eloop
+else
+ELOOP_FILE=$(CONFIG_ELOOP)
 endif
-
-ifdef CONFIG_ELOOP_POLL
-CFLAGS += -DCONFIG_ELOOP_POLL
-endif
-
+OBJS += ../src/utils/$(ELOOP_FILE).o
+OBJS_c += ../src/utils/$(ELOOP_FILE).o
 
 ifdef CONFIG_EAPOL_TEST
 CFLAGS += -Werror -DEAPOL_TEST
@@ -1510,7 +1521,7 @@  ifdef CONFIG_PRIVSEP
 OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o
 OBJS_priv += $(OBJS_l2)
 OBJS_priv += ../src/utils/os_$(CONFIG_OS).o
-OBJS_priv += ../src/utils/$(CONFIG_ELOOP).o
+OBJS_priv += ../src/utils/$(ELOOP_FILE).o
 OBJS_priv += ../src/utils/common.o
 OBJS_priv += ../src/utils/wpa_debug.o
 OBJS_priv += ../src/utils/wpabuf.o