Skip to content

Commit a8356d4

Browse files
jszakmeistergitster
authored andcommitted
configure: don't use -lintl when there is no gettext support
The current configure script uses -lintl if gettext is not found in the C library, but does so before checking if there is libintl.h available in the first place, in which case we would later define NO_GETTEXT. Instead, check for the existence of libintl.h first. Only when libintl.h exists and libintl is not in libc, ask for -lintl. Signed-off-by: John Szakmeister <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 828ea97 commit a8356d4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

configure.ac

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,18 @@ AC_CHECK_LIB([c], [gettext],
640640
[LIBC_CONTAINS_LIBINTL=YesPlease],
641641
[LIBC_CONTAINS_LIBINTL=])
642642
AC_SUBST(LIBC_CONTAINS_LIBINTL)
643-
test -n "$LIBC_CONTAINS_LIBINTL" || LIBS="$LIBS -lintl"
643+
644+
#
645+
# Define NO_GETTEXT if you don't want Git output to be translated.
646+
# A translated Git requires GNU libintl or another gettext implementation
647+
AC_CHECK_HEADER([libintl.h],
648+
[NO_GETTEXT=],
649+
[NO_GETTEXT=YesPlease])
650+
AC_SUBST(NO_GETTEXT)
651+
652+
if test -z "$NO_GETTEXT"; then
653+
test -n "$LIBC_CONTAINS_LIBINTL" || LIBS="$LIBS -lintl"
654+
fi
644655

645656
## Checks for header files.
646657
AC_MSG_NOTICE([CHECKS for header files])
@@ -824,13 +835,6 @@ AC_CHECK_HEADER([paths.h],
824835
[HAVE_PATHS_H=])
825836
AC_SUBST(HAVE_PATHS_H)
826837
#
827-
# Define NO_GETTEXT if you don't want Git output to be translated.
828-
# A translated Git requires GNU libintl or another gettext implementation
829-
AC_CHECK_HEADER([libintl.h],
830-
[NO_GETTEXT=],
831-
[NO_GETTEXT=YesPlease])
832-
AC_SUBST(NO_GETTEXT)
833-
#
834838
# Define HAVE_LIBCHARSET_H if have libcharset.h
835839
AC_CHECK_HEADER([libcharset.h],
836840
[HAVE_LIBCHARSET_H=YesPlease],

0 commit comments

Comments
 (0)