diff options
Diffstat (limited to 'erts')
-rw-r--r-- | erts/configure.in | 22 | ||||
-rw-r--r-- | erts/emulator/Makefile.in | 11 | ||||
-rw-r--r-- | erts/preloaded/src/erl_init.erl | 20 |
3 files changed, 48 insertions, 5 deletions
diff --git a/erts/configure.in b/erts/configure.in index 5f969a0a8b..f17572142d 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -1329,6 +1329,28 @@ LIBS=$zlib_save_LIBS fi AC_SUBST(Z_LIB) + +dnl ------------- +dnl esock +dnl ------------- + +AC_ARG_ENABLE(esock, +AS_HELP_STRING([--enable-esock], [enable builtin experimental socket (as a nif) support (default)]) +AS_HELP_STRING([--disable-esock], [disable builtin experimental socket (as a nif) support])) + +dnl Default value +USE_ESOCK=yes + +if test "x$enable_esock" = "xyes"; then + USE_ESOCK=yes +else + if test "x$enable_esock" = "xno"; then + USE_ESOCK=no + fi +fi +AC_SUBST(USE_ESOCK) + + dnl dnl This test kindly borrowed from Tcl dnl diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 448f41b523..1c85c4e827 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -843,6 +843,14 @@ ESOCK_RUN_OBJS = \ $(OBJDIR)/socket_dbg.o \ $(OBJDIR)/socket_tarray.o \ $(OBJDIR)/socket_util.o +ifeq ($(USE_ESOCK), yes) +ESOCK_NIF_OBJS = \ + $(OBJDIR)/socket_nif.o \ + $(OBJDIR)/net_nif.o +else +ESOCK_NIF_OBJS = \ + $(OBJDIR)/net_nif.o +endif else ESOCK_RUN_OBJS = endif @@ -903,8 +911,7 @@ NIF_OBJS = \ $(OBJDIR)/prim_buffer_nif.o \ $(OBJDIR)/prim_file_nif.o \ $(OBJDIR)/zlib_nif.o \ - $(OBJDIR)/socket_nif.o \ - $(OBJDIR)/net_nif.o + $(ESOCK_NIF_OBJS) ifeq ($(TARGET),win32) DRV_OBJS = \ diff --git a/erts/preloaded/src/erl_init.erl b/erts/preloaded/src/erl_init.erl index 6edead362c..a650367c25 100644 --- a/erts/preloaded/src/erl_init.erl +++ b/erts/preloaded/src/erl_init.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. +%% Copyright Ericsson AB 2000-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -35,8 +35,8 @@ start(Mod, BootArgs) -> erl_tracer:on_load(), prim_buffer:on_load(), prim_file:on_load(), - socket:on_load(), - net:on_load(), + conditional_load(socket), % socket:on_load(), + net:on_load(), % This needs to be loaded since it contains 'other' funcs... %% Proceed to the specified boot module run(Mod, boot, BootArgs). @@ -48,3 +48,17 @@ run(M, F, A) -> true -> M:F(A) end. + +conditional_load(Mod) -> + conditional_load(Mod, erlang:loaded()). + +conditional_load(_Mod, []) -> + ok; +conditional_load(Mod, [Mod|_]) -> + Mod:on_load(); +conditional_load(Mod, [_|T]) -> + conditional_load(Mod, T). + + + + |