configure: Pass compiler flag to enable ICU only when building util.encodings
authorKim Alvefur <zash@zash.se>
Sun, 12 Jul 2020 23:28:04 +0200
changeset 11013 74ef9f2334f3
parent 11012 fd735fe2fc50
child 11014 6b27cb706b89
configure: Pass compiler flag to enable ICU only when building util.encodings Passing it in CFLAGS applied to all modules, which was not needed.
configure
util-src/GNUmakefile
util-src/makefile
--- a/configure	Fri Jul 10 13:01:17 2020 +0100
+++ b/configure	Sun Jul 12 23:28:04 2020 +0200
@@ -524,7 +524,7 @@
 if [ "$IDN_LIBRARY" = "icu" ]
 then
    IDNA_LIBS="$ICU_FLAGS"
-   CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
+   IDNA_FLAGS="-DUSE_STRINGPREP_ICU"
 fi
 if [ "$IDN_LIBRARY" = "idn" ]
 then
@@ -569,6 +569,7 @@
 LUA_LIBDIR=$LUA_LIBDIR
 LUA_BINDIR=$LUA_BINDIR
 IDN_LIB=$IDN_LIB
+IDNA_FLAGS=$IDNA_FLAGS
 IDNA_LIBS=$IDNA_LIBS
 OPENSSL_LIBS=$OPENSSL_LIBS
 CFLAGS=$CFLAGS
--- a/util-src/GNUmakefile	Fri Jul 10 13:01:17 2020 +0100
+++ b/util-src/GNUmakefile	Sun Jul 12 23:28:04 2020 +0200
@@ -24,6 +24,7 @@
 clean:
 	rm -f $(ALL) $(patsubst %.so,%.o,$(ALL))
 
+encodings.o: CFLAGS+=$(IDNA_FLAGS)
 encodings.so: LDLIBS+=$(IDNA_LIBS)
 
 hashes.so: LDLIBS+=$(OPENSSL_LIBS)
--- a/util-src/makefile	Fri Jul 10 13:01:17 2020 +0100
+++ b/util-src/makefile	Sun Jul 12 23:28:04 2020 +0200
@@ -23,6 +23,8 @@
 clean:
 	rm -f $(ALL) $(patsubst %.so,%.o,$(ALL))
 
+encodings.o: encodings.c
+	$(CC) $(CFLAGS) $(IDNA_FLAGS) -c -o $@ $<
 encodings.so: encodings.o
 	$(LD) $(LDFLAGS) -o $@ $< $(LDLIBS) $(IDNA_LIBS)