diff --git a/Makefile b/Makefile index d8af2bd..140ba86 100644 --- a/Makefile +++ b/Makefile @@ -11,14 +11,24 @@ SIGNING_KEY_ID=F8D7D525 VERSION=HEAD PACKAGE_NAME=rfc4627_jsonrpc -## The path to httpd.hrl has changed in OTP R14A and newer. Detect the -## change, and supply a compile-time macro definition to allow -## rfc4627_jsonrpc_inets.erl to adapt to the new path. -ifeq ($(shell test R14A \> $$(erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt().') && echo yes),yes) -INETS_DEF=-Dold_inets +## The path to httpd.hrl changed sometime between OTP R12 and R13B03, +## and then changed again between OTP R14B and R14B01. Detect the +## changes, and supply compile-time macro definitions to allow +## rfc4627_jsonrpc_inets.erl to adapt to the new paths. +ERLANG_OTP_RELEASE:=$(shell erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt().') +$(info Building for OTP release $(ERLANG_OTP_RELEASE).) +ifeq ($(shell test R13B03 \> $(ERLANG_OTP_RELEASE) && echo yes),yes) +$(info Using path to INETS httpd.hrl that existed before R13B03.) +INETS_DEF=-Dinets_pre_r13b03 else +ifeq ($(shell test R14B01 \> $(ERLANG_OTP_RELEASE) && echo yes),yes) +$(info Using path to INETS httpd.hrl that existed before R14B01.) +INETS_DEF=-Dinets_pre_r14b01 +else +$(info Using path to INETS httpd.hrl that exists in releases at and after R14B01.) INETS_DEF= endif +endif all: $(TARGETS) diff --git a/src/rfc4627_jsonrpc_inets.erl b/src/rfc4627_jsonrpc_inets.erl index 7890315..6f7ae0e 100644 --- a/src/rfc4627_jsonrpc_inets.erl +++ b/src/rfc4627_jsonrpc_inets.erl @@ -88,13 +88,17 @@ -module(rfc4627_jsonrpc_inets). -include("rfc4627_jsonrpc.hrl"). -%% The path to httpd.hrl has changed in OTP R14A and newer. Our -%% Makefile detects the change for us, and supplies a compile-time -%% macro definition to allow us to adapt to the new path. --ifdef(old_inets). +%% The path to httpd.hrl has changed with various OTP releases. Our +%% Makefile detects the changes for us, and supplies compile-time +%% macro definitions to allow us to adapt. +-ifdef(inets_pre_r13b03). -include_lib("inets/src/httpd.hrl"). -else. +-ifdef(inets_pre_r14b01). -include_lib("inets/src/http_server/httpd.hrl"). +-else. +-include_lib("inets/include/httpd.hrl"). +-endif. -endif. -export([do/1, load/2]).