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 <john@szakmeister.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Szakmeister committed Feb 18, 2012 at 14:38 UTC a8356d43e3602fb65a9ae57a5cf1ca98a75f5cc3
1 file changed +12 -8
configure.ac
+12 -8
@@ -640,7 +640,18 @@ AC_CHECK_LIB([c], [gettext],
640 [LIBC_CONTAINS_LIBINTL=YesPlease],
641 [LIBC_CONTAINS_LIBINTL=])
642 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
655
656 ## Checks for header files.
657 AC_MSG_NOTICE([CHECKS for header files])
@@ -824,13 +835,6 @@ AC_CHECK_HEADER([paths.h],
835 [HAVE_PATHS_H=])
836 AC_SUBST(HAVE_PATHS_H)
837 #
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 -#
838 # Define HAVE_LIBCHARSET_H if have libcharset.h
839 AC_CHECK_HEADER([libcharset.h],
840 [HAVE_LIBCHARSET_H=YesPlease],