Browse Source

kamcmd: add /usr/local to C defs and libs if readline is detected in the path

- reported by GH#920
Daniel-Constantin Mierla 8 years ago
parent
commit
dad79f3407
1 changed files with 12 additions and 3 deletions
  1. 12 3
      utils/kamcmd/Makefile

+ 12 - 3
utils/kamcmd/Makefile

@@ -14,8 +14,9 @@ else
 	NAME?=kamcmd
 endif
 
+readline_localpath=$(LOCALBASE)/include/readline/readline.h
 readline_locations= /usr/include/readline/readline.h \
-					$(LOCALBASE)/include/readline/readline.h
+					$(readline_localpath)
 
 use_readline ?=
 ifneq (,$(MAKECMDGOALS))
@@ -58,7 +59,7 @@ endif
 ifeq ($(OS), darwin)
 readline_locations= /opt/local/include/readline/readline.h \
 					/usr/include/readline/readline.h \
-					$(LOCALBASE)/include/readline/readline.h
+					$(readline_localpath)
 	LIBS:= -lresolv
 endif
 ifneq (,$(findstring cygwin, $(OS)))
@@ -77,13 +78,21 @@ endif
 endif
 
 ifeq ($(use_readline),1)
+
 ifneq (,$(findstring opt, $(readline_path)))
 	DEFS+=-DUSE_READLINE -I /opt/local/include
-	LIBS+=-L /opt/local/lib -lreadline -lncurses
+	LIBS+=-L/opt/local/lib -lreadline -lncurses
 else
+
+ifeq ($(readline_path),$(readline_localpath))
+	DEFS+=-I$(LOCALBASE)/include
+	LIBS+=-L$(LOCALBASE)/lib
+endif
+
 	DEFS+=-DUSE_READLINE
 	LIBS+=-lreadline -lncurses
 endif
+
 endif