]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
iconv: Allow using GNU libiconv
authorOlliver Schinagl <oliver@schinagl.nl>
Thu, 23 Feb 2023 17:49:44 +0000 (18:49 +0100)
committerFlole998 <Flole998@users.noreply.github.com>
Thu, 23 Mar 2023 02:24:42 +0000 (03:24 +0100)
TVHeadend has a hard-dependency on libiconv. Lets make this a little bit
more flexible by also allowing gnu-libiconv.

This helps with musl-based systems, such as Alpine Linux.

Contributes to #4940.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Makefile
configure
src/intlconv.c

index a56a2fbdf9d27b99ff6f918227ca57a6042596dc..c4aeab5d506b464e80fa482875025b932bd21b19 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -67,6 +67,10 @@ LDFLAGS += -Wl,-z,now
 ifeq ($(CONFIG_LIBICONV),yes)
 LDFLAGS += -liconv
 endif
+ifeq ($(CONFIG_GNU_LIBICONV),yes)
+CFLAGS += -D_GNU_LIBICONV
+LDFLAGS += -liconv
+endif
 ifeq ($(PLATFORM), darwin)
 LDFLAGS += -framework CoreServices
 else
index 8ce559fa7be1acbe1599164d2c6035e75e53e75a..82c0efb60063361d35310c4976709c04d69e34b9 100755 (executable)
--- a/configure
+++ b/configure
@@ -325,9 +325,19 @@ int test(void)
 }
 '
 
-# a check for the external iconv library
+# a check for the external (gnu)iconv library
 # for build-in libc iconv routines this check should fail
 # note that iconv routines are mandatory
+check_cc_snippet gnu_libiconv '
+#include <gnu-libiconv/iconv.h>
+#define TEST test
+int test(void)
+{
+  iconv_t ic = iconv_open("ASCII", "ASCII");
+  return 0;
+}
+' -liconv
+
 check_cc_snippet libiconv '
 #include <iconv.h>
 #define TEST test
@@ -338,7 +348,9 @@ int test(void)
 }
 ' -liconv
 
-if enabled libiconv; then
+if enabled gnu_libiconv; then
+  printf "    ^ using gnu libiconv library\n"
+elif enabled libiconv; then
   printf "    ^ using external iconv library\n"
 else
   printf "    ^ using build-in glibc iconv routines\n"
index 48a11ec8106d60130fd0ce7e5e4f127624bce8f5..617341f550a03af07ede6e8beadbe353902e0748 100644 (file)
@@ -1,4 +1,8 @@
+#ifdef _GNU_LIBICONV
+#include <gnu-libiconv/iconv.h>
+#else
 #include <iconv.h>
+#endif
 #include "tvheadend.h"
 #include "intlconv.h"