Skip to content

Commit b71e56a

Browse files
vkochangitster
authored andcommitted
autoconf: #include <libintl.h> when checking for gettext()
Some libc implementations like uclibc or musl provides gettext stubs via libintl library but this case is not checked by AC_CHECK_LIB(c, gettext ...) because gcc has gettext as builtin which passess the check. So check it with included libintl.h where gettext may unfold into libintl_gettext which will cause check to fail if libintl_gettext are needed to be linked with -lintl. Signed-off-by: Vadim Kochan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aeb582a commit b71e56a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

configure.ac

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,19 @@ AC_CHECK_LIB([c], [basename],
763763
GIT_CONF_SUBST([NEEDS_LIBGEN])
764764
test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen"
765765

766-
AC_CHECK_LIB([c], [gettext],
767-
[LIBC_CONTAINS_LIBINTL=YesPlease],
768-
[LIBC_CONTAINS_LIBINTL=])
766+
AC_DEFUN([LIBINTL_SRC], [
767+
AC_LANG_PROGRAM([[
768+
#include <libintl.h>
769+
]],[[
770+
char *msg = gettext("test");
771+
]])])
772+
773+
AC_MSG_CHECKING([if libc contains libintl])
774+
AC_LINK_IFELSE([LIBINTL_SRC],
775+
[AC_MSG_RESULT([yes])
776+
LIBC_CONTAINS_LIBINTL=YesPlease],
777+
[AC_MSG_RESULT([no])
778+
LIBC_CONTAINS_LIBINTL=])
769779
GIT_CONF_SUBST([LIBC_CONTAINS_LIBINTL])
770780

771781
#

0 commit comments

Comments
 (0)