aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-03-07 17:27:44 +0100
committerMicael Karlberg <[email protected]>2019-04-30 10:58:16 +0200
commit9e34d5b91fda4c1021090fa00a8921cc2c8d2cb8 (patch)
tree8580ab0743b2dee79169b6b30af2d6b225ef7704
parent759ec896d7f254db2996cbb503c1ef883e6714b0 (diff)
downloadotp-9e34d5b91fda4c1021090fa00a8921cc2c8d2cb8.tar.gz
otp-9e34d5b91fda4c1021090fa00a8921cc2c8d2cb8.tar.bz2
otp-9e34d5b91fda4c1021090fa00a8921cc2c8d2cb8.zip
[socket] Preliminary - make socket configurable
Preliminary work to make socket configurable (enable and disable). OTP-15658
-rw-r--r--erts/configure.in22
-rw-r--r--erts/emulator/Makefile.in11
-rw-r--r--erts/preloaded/src/erl_init.erl20
-rw-r--r--make/configure.in6
-rw-r--r--make/otp.mk.in4
5 files changed, 56 insertions, 7 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).
+
+
+
+
diff --git a/make/configure.in b/make/configure.in
index bf3fd0751f..c4b89c4f45 100644
--- a/make/configure.in
+++ b/make/configure.in
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl %CopyrightBegin%
dnl
-dnl Copyright Ericsson AB 1998-2016. All Rights Reserved.
+dnl Copyright Ericsson AB 1998-2019. All Rights Reserved.
dnl
dnl Licensed under the Apache License, Version 2.0 (the "License");
dnl you may not use this file except in compliance with the License.
@@ -298,6 +298,10 @@ AC_ARG_ENABLE(builtin-zlib,
AS_HELP_STRING([--enable-builtin-zlib],
[force use of our own built-in zlib]))
+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]))
+
AC_ARG_ENABLE(sharing-preserving,
AS_HELP_STRING([--enable-sharing-preserving],
[enable copying of terms without destroying sharing]))
diff --git a/make/otp.mk.in b/make/otp.mk.in
index ceff8f7c31..cdddb90734 100644
--- a/make/otp.mk.in
+++ b/make/otp.mk.in
@@ -4,7 +4,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1997-2016. All Rights Reserved.
+# Copyright Ericsson AB 1997-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.
@@ -51,6 +51,8 @@ TYPES = @TYPES@
USE_PGO = @USE_PGO@
+USE_ESOCK = @USE_ESOCK@
+
# Slash separated list of return values from $(origin VAR)
# that are untrusted - set default in this file instead.
# The list is not space separated since some return values