Skip to content

Commit 4f03a78

Browse files
rofl0rxhebox
authored andcommitted
Makefile: link -liconv if necessary
closes #33
1 parent 6dc2459 commit 4f03a78

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ INSTALL ?= ./install.sh
4242

4343
-include config.mak
4444

45+
LDLIBS:=$(shell echo "int main(){}" | $(CC) -liconv -x c - >/dev/null 2>&1 && printf %s -liconv)
46+
4547
BUILDCFLAGS=$(CFLAGS)
4648

4749
all: $(ALL_LIBS) $(ALL_TOOLS)
@@ -62,10 +64,10 @@ libintl.a: $(LIBOBJS)
6264
$(RANLIB) $@
6365

6466
msgmerge: $(OBJS)
65-
$(CC) -static -o $@ src/msgmerge.o $(PARSEROBJS) $(LDFLAGS)
67+
$(CC) -static -o $@ src/msgmerge.o $(PARSEROBJS) $(LDFLAGS) $(LDLIBS)
6668

6769
msgfmt: $(OBJS)
68-
$(CC) -static -o $@ src/msgfmt.o $(PARSEROBJS) $(LDFLAGS)
70+
$(CC) -static -o $@ src/msgfmt.o $(PARSEROBJS) $(LDFLAGS) $(LDLIBS)
6971

7072
xgettext:
7173
cp src/xgettext.sh ./xgettext

0 commit comments

Comments
 (0)