summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2018-05-29 18:34:52 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-06-02 14:25:28 +0200
commit51cb204eb2a7ee840a86cc66b762ddfff56f01b2 (patch)
tree1d6e587b37be8bcd6356eb7731a63f8985629112
parente32415744c0e7f2d75d4669addefc1b50f977cd6 (diff)
downloadii-master.zip
ii-master.tar.gz
ii-master.tar.bz2
Add a config option to link against system or shipped strlcpyHEADmaster
-rw-r--r--Makefile4
-rw-r--r--config.mk7
-rw-r--r--ii.c3
3 files changed, 9 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 3f9669f..21c0311 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
include config.mk
-SRC = ii.c strlcpy.c
+SRC = ii.c
OBJ = $(SRC:.c=.o)
IICFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE $(CFLAGS)
@@ -19,7 +19,7 @@ options:
.c.o:
$(CC) $(IICFLAGS) -c $<
-ii: $(OBJ)
+ii: $(OBJ) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
$(OBJ): arg.h
diff --git a/config.mk b/config.mk
index 3b629db..957bae0 100644
--- a/config.mk
+++ b/config.mk
@@ -6,6 +6,9 @@ PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
DOCPREFIX = ${PREFIX}/share/doc
-CFLAGS = -Os
+# on systems which provide strlcpy(3),
+# remove NEED_STRLCPY from CFLAGS and
+# remove strlcpy.o from LIBS
+CFLAGS = -DNEED_STRLCPY -Os
LDFLAGS = -s
-LIBS =
+LIBS = strlcpy.o
diff --git a/ii.c b/ii.c
index fc02d7f..53fa986 100644
--- a/ii.c
+++ b/ii.c
@@ -24,8 +24,9 @@ char *argv0;
#include "arg.h"
-#undef strlcpy
+#ifdef NEED_STRLCPY
size_t strlcpy(char *, const char *, size_t);
+#endif /* NEED_STRLCPY */
#define IRC_CHANNEL_MAX 200
#define IRC_MSG_MAX 512 /* guaranteed to be <= than PIPE_BUF */