kamcmd: add /usr/local to C defs and libs if readline is detected in the path
authorDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 9 Jan 2017 17:18:18 +0000 (18:18 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 9 Jan 2017 17:18:18 +0000 (18:18 +0100)
- reported by GH#920

utils/kamcmd/Makefile

index 1af68e2..aae4f13 100644 (file)
@@ -14,8 +14,9 @@ else
        NAME?=kamcmd
 endif
 
        NAME?=kamcmd
 endif
 
+readline_localpath=$(LOCALBASE)/include/readline/readline.h
 readline_locations= /usr/include/readline/readline.h \
 readline_locations= /usr/include/readline/readline.h \
-                                       $(LOCALBASE)/include/readline/readline.h
+                                       $(readline_localpath)
 
 use_readline ?=
 ifneq (,$(MAKECMDGOALS))
 
 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 \
 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)))
        LIBS:= -lresolv
 endif
 ifneq (,$(findstring cygwin, $(OS)))
@@ -77,13 +78,21 @@ endif
 endif
 
 ifeq ($(use_readline),1)
 endif
 
 ifeq ($(use_readline),1)
+
 ifneq (,$(findstring opt, $(readline_path)))
        DEFS+=-DUSE_READLINE -I /opt/local/include
 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
 else
+
+ifeq ($(readline_path),$(readline_localpath))
+       DEFS+=-I$(LOCALBASE)/include
+       LIBS+=-L$(LOCALBASE)/lib
+endif
+
        DEFS+=-DUSE_READLINE
        LIBS+=-lreadline -lncurses
 endif
        DEFS+=-DUSE_READLINE
        LIBS+=-lreadline -lncurses
 endif
+
 endif
 
 
 endif