summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhe <xw897002528@gmail.com>2017-07-29 20:48:20 +0800
committerxhe <xw897002528@gmail.com>2017-07-29 20:48:20 +0800
commitf8e1033ef60d7c79c0771611bb8c87623a36ed75 (patch)
treee414068e6ab0da7448eb7ddd2e352e5134dbca70
parentd7800312c4d4624b7c7fa9bc0496585967db5134 (diff)
downloadgettext-tiny-f8e1033ef60d7c79c0771611bb8c87623a36ed75.tar.gz
libintl: make it optional and configurable
As rofl0r suggested, libintl.a now comes in two flavours, no-op or musl, or we could just disable it. no-op: gettext functions just return the input string as translation and symbols help to get past configure scripts musl: symbols as in no-op, with libintl built-in in to recent musl version Use LIBINTL=FLAVOR, FLAVOR can be NOOP(no-op), MUSL, NONE(disable)
-rw-r--r--Makefile16
-rw-r--r--libintl/libintl-musl.c5
2 files changed, 17 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index bd709d4..283354e 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,16 @@ libdir=$(prefix)/lib
sysconfdir=$(prefix)/etc
m4dir=$(prefix)/share/gettext-tiny
-LIBSRC = $(sort $(wildcard libintl/*.c))
+ifeq ($(LIBINTL), MUSL)
+ LIBSRC = libintl/libintl-musl.c
+ HEADERS =
+else ifeq ($(LIBINTL), NONE)
+ LIBSRC =
+ HEADERS =
+else
+ LIBSRC = libintl/libintl.c
+ HEADERS = libintl.h
+endif
PROGSRC = $(sort $(wildcard src/*.c))
PARSEROBJS = src/poparser.o src/StringEscape.o
@@ -13,11 +22,10 @@ PROGOBJS = $(PROGSRC:.c=.o)
LIBOBJS = $(LIBSRC:.c=.o)
OBJS = $(PROGOBJS) $(LIBOBJS)
-
-HEADERS = libintl.h
ALL_INCLUDES = $(HEADERS)
-
+ifneq ($(LIBINTL), NONE)
ALL_LIBS=libintl.a
+endif
ALL_TOOLS=msgfmt msgmerge xgettext autopoint
ALL_M4S=$(sort $(wildcard m4/*.m4))
diff --git a/libintl/libintl-musl.c b/libintl/libintl-musl.c
new file mode 100644
index 0000000..eb00506
--- /dev/null
+++ b/libintl/libintl-musl.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+/* trick configure tests checking for gnu libintl, as in the copy included in gdb */
+const char *_nl_expand_alias () { return NULL; }
+int _nl_msg_cat_cntr = 0;