diff --git a/Makefile.cfg b/Makefile.cfg
index 91988b776cdf0fdcf6b6a3d83386fb5cb876a725..35dc0694303b06b2adee1bbfc706b18735f8ca67 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -65,6 +65,10 @@ COVERAGE := no
 # Set it to 'no' to use a simplified debugger UI.
 ADVANCED_DEBUGGER_UI := no
 
+# Should be set to 'yes' if the version of the 'editline' library is 2.0.53 or older
+# (i.e. 'readline.h' v1.34 or older).
+OLD_LIBEDIT := no
+
 # Your platform. Allowed values: SOLARIS, SOLARIS8, LINUX, FREEBSD,
 # WIN32. Decided automagically if not defined (recommended).
 # PLATFORM :=
@@ -239,6 +243,10 @@ ifeq ($(ADVANCED_DEBUGGER_UI), yes)
   CPPFLAGS += -DADVANCED_DEBUGGER_UI
 endif
 
+ifeq ($(OLD_LIBEDIT), yes)
+  CPPFLAGS += -DOLD_LIBEDIT
+endif
+
 # Directory which contains the code for POSIX regular expression handling.
 # It is needed on platforms where the system's libc does not support POSIX
 # regexps. This is the case for Mingw.
diff --git a/core/DebuggerUI.cc b/core/DebuggerUI.cc
index b176990101afc599d323b485c2d4425800544799..f95160e8f54415da80c7926307d1adf4a2a0fd3b 100644
--- a/core/DebuggerUI.cc
+++ b/core/DebuggerUI.cc
@@ -221,7 +221,7 @@ void TTCN_Debugger_UI::init()
   // read history from file, don't bother if it does not exist
   read_history(ttcn3_history_filename);
   // set our own command completion function
-#ifdef WIN32
+#ifdef OLD_LIBEDIT
   rl_completion_entry_function = (Function*)complete_command;
 #else
   rl_completion_entry_function = complete_command;
diff --git a/mctr2/cli/Cli.cc b/mctr2/cli/Cli.cc
index 85088e8bf0e62dac61e502ca02dbc1a2c8c952e2..eb747a84e0c3ba47e4702a15f8e77f210f032e16 100644
--- a/mctr2/cli/Cli.cc
+++ b/mctr2/cli/Cli.cc
@@ -372,7 +372,7 @@ int Cli::interactiveMode()
   // Read history from file, don't bother if it does not exist!
   read_history(ttcn3_history_filename);
   // Set our own command completion function
-#ifdef WIN32
+#ifdef OLD_LIBEDIT
   rl_completion_entry_function = (Function*)completeCommand;
 #else
   rl_completion_entry_function = completeCommand;