Skip to content

Commit f8e1033

Browse files
committed
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)
1 parent d780031 commit f8e1033

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@ libdir=$(prefix)/lib
55
sysconfdir=$(prefix)/etc
66
m4dir=$(prefix)/share/gettext-tiny
77

8-
LIBSRC = $(sort $(wildcard libintl/*.c))
8+
ifeq ($(LIBINTL), MUSL)
9+
LIBSRC = libintl/libintl-musl.c
10+
HEADERS =
11+
else ifeq ($(LIBINTL), NONE)
12+
LIBSRC =
13+
HEADERS =
14+
else
15+
LIBSRC = libintl/libintl.c
16+
HEADERS = libintl.h
17+
endif
918
PROGSRC = $(sort $(wildcard src/*.c))
1019

1120
PARSEROBJS = src/poparser.o src/StringEscape.o
1221
PROGOBJS = $(PROGSRC:.c=.o)
1322
LIBOBJS = $(LIBSRC:.c=.o)
1423
OBJS = $(PROGOBJS) $(LIBOBJS)
1524

16-
17-
HEADERS = libintl.h
1825
ALL_INCLUDES = $(HEADERS)
19-
26+
ifneq ($(LIBINTL), NONE)
2027
ALL_LIBS=libintl.a
28+
endif
2129
ALL_TOOLS=msgfmt msgmerge xgettext autopoint
2230
ALL_M4S=$(sort $(wildcard m4/*.m4))
2331

libintl/libintl-musl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
3+
/* trick configure tests checking for gnu libintl, as in the copy included in gdb */
4+
const char *_nl_expand_alias () { return NULL; }
5+
int _nl_msg_cat_cntr = 0;

0 commit comments

Comments
 (0)