Skip to content

Commit ef55bd7

Browse files
committed
Merge branch 'dp/i18n-libcharset' into maint
* dp/i18n-libcharset: Makefile: introduce CHARSET_LIB to link with -lcharset
2 parents 6f61eb2 + b522528 commit ef55bd7

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ all::
5353
# FreeBSD can use either, but MinGW and some others need to use
5454
# libcharset.h's locale_charset() instead.
5555
#
56+
# Define CHARSET_LIB to you need to link with library other than -liconv to
57+
# use locale_charset() function. On some platforms this needs to set to
58+
# -lcharset
59+
#
5660
# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
5761
# need -lintl when linking.
5862
#
@@ -1695,6 +1699,7 @@ endif
16951699

16961700
ifdef HAVE_LIBCHARSET_H
16971701
BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
1702+
EXTLIBS += $(CHARSET_LIB)
16981703
endif
16991704

17001705
ifdef HAVE_DEV_TTY

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
7474
NO_PTHREADS=@NO_PTHREADS@
7575
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
7676
PTHREAD_LIBS=@PTHREAD_LIBS@
77+
CHARSET_LIB=@CHARSET_LIB@

configure.ac

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,16 @@ AC_CHECK_HEADER([libcharset.h],
836836
[HAVE_LIBCHARSET_H=YesPlease],
837837
[HAVE_LIBCHARSET_H=])
838838
AC_SUBST(HAVE_LIBCHARSET_H)
839+
# Define CHARSET_LIB if libiconv does not export the locale_charset symbol
840+
# and libcharset does
841+
CHARSET_LIB=
842+
AC_CHECK_LIB([iconv], [locale_charset],
843+
[],
844+
[AC_CHECK_LIB([charset], [locale_charset],
845+
[CHARSET_LIB=-lcharset])
846+
]
847+
)
848+
AC_SUBST(CHARSET_LIB)
839849
#
840850
# Define NO_STRCASESTR if you don't have strcasestr.
841851
GIT_CHECK_FUNC(strcasestr,

0 commit comments

Comments
 (0)