Skip to content

Commit

Permalink
Adapt more accurately to locations of httpd.hrl.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyg committed Mar 31, 2012
1 parent c91a6bd commit 0ad5226
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
20 changes: 15 additions & 5 deletions Makefile
Expand Up @@ -11,14 +11,24 @@ SIGNING_KEY_ID=F8D7D525
VERSION=HEAD VERSION=HEAD
PACKAGE_NAME=rfc4627_jsonrpc PACKAGE_NAME=rfc4627_jsonrpc


## The path to httpd.hrl has changed in OTP R14A and newer. Detect the ## The path to httpd.hrl changed sometime between OTP R12 and R13B03,
## change, and supply a compile-time macro definition to allow ## and then changed again between OTP R14B and R14B01. Detect the
## rfc4627_jsonrpc_inets.erl to adapt to the new path. ## changes, and supply compile-time macro definitions to allow
ifeq ($(shell test R14A \> $$(erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt().') && echo yes),yes) ## rfc4627_jsonrpc_inets.erl to adapt to the new paths.
INETS_DEF=-Dold_inets 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 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= INETS_DEF=
endif endif
endif


all: $(TARGETS) all: $(TARGETS)


Expand Down
12 changes: 8 additions & 4 deletions src/rfc4627_jsonrpc_inets.erl
Expand Up @@ -88,13 +88,17 @@
-module(rfc4627_jsonrpc_inets). -module(rfc4627_jsonrpc_inets).
-include("rfc4627_jsonrpc.hrl"). -include("rfc4627_jsonrpc.hrl").


%% The path to httpd.hrl has changed in OTP R14A and newer. Our %% The path to httpd.hrl has changed with various OTP releases. Our
%% Makefile detects the change for us, and supplies a compile-time %% Makefile detects the changes for us, and supplies compile-time
%% macro definition to allow us to adapt to the new path. %% macro definitions to allow us to adapt.
-ifdef(old_inets). -ifdef(inets_pre_r13b03).
-include_lib("inets/src/httpd.hrl"). -include_lib("inets/src/httpd.hrl").
-else. -else.
-ifdef(inets_pre_r14b01).
-include_lib("inets/src/http_server/httpd.hrl"). -include_lib("inets/src/http_server/httpd.hrl").
-else.
-include_lib("inets/include/httpd.hrl").
-endif.
-endif. -endif.


-export([do/1, load/2]). -export([do/1, load/2]).
Expand Down

0 comments on commit 0ad5226

Please sign in to comment.