summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-08-11 09:37:05 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-08-11 17:51:50 +0100
commit2a38a0a1c10547522009a8aed515f618d50851fc (patch)
tree7288d164e8b8c8b8373b8dec6feea8a6f5725b77
parentdb07992146bd8cbde311178361ffa2335b92ef82 (diff)
downloadgss-ntlmssp-2a38a0a1c10547522009a8aed515f618d50851fc.tar.gz
gss-ntlmssp-2a38a0a1c10547522009a8aed515f618d50851fc.tar.xz
gss-ntlmssp-2a38a0a1c10547522009a8aed515f618d50851fc.zip
Add support for building with NLS
-rw-r--r--Makefile.am16
-rw-r--r--conf_macros.m412
-rw-r--r--configure.ac16
-rw-r--r--po/LINGUAS1
-rw-r--r--po/Makefile.am41
5 files changed, 85 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 7327f34..e5dfdf1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,6 +4,9 @@ SUBDIRS =
if HAVE_MANPAGES
SUBDIRS += man
endif
+if HAVE_NLS
+SUBDIRS += po
+endif
# Some old versions of automake don't define builddir
builddir ?= .
@@ -31,6 +34,9 @@ if HAVE_GCC
-Werror-implicit-function-declaration \
-fno-strict-aliasing
endif
+if HAVE_NLS
+ AM_CFLAGS += -DLOCALEDIR="\"$(localedir)\""
+endif
dist_pkgconfig_DATA =
@@ -100,6 +106,8 @@ gssapidir = $(includedir)/gssapi
dist_gssapi_HEADERS = \
src/gssapi_ntlmssp.h
+POTFILES = src/gss_err.c
+
####################
# Program Binaries #
####################
@@ -185,6 +193,14 @@ rpmroot:
mkdir -p $(RPMBUILD)/SPECS
mkdir -p $(RPMBUILD)/SRPMS
+po/$(PACKAGE).pot: $(POTFILES)
+ @echo "Regenerating $@" ; rm -f $@ && \
+ xgettext --directory=$(top_srcdir) --from-code=UTF-8 \
+ --sort-by-file --add-comments --keyword=_ --keyword=N_ \
+ --package-name="@PACKAGE@" --package-version="@VERSION@" \
+ --msgid-bugs-address="simo@samba.org" \
+ -o $@ $(POTFILES)
+
rpms: dist-gzip rpmroot
cp $(builddir)/contrib/gssntlmssp.spec $(RPMBUILD)/SPECS
cp $(distdir).tar.gz $(RPMBUILD)/SOURCES
diff --git a/conf_macros.m4 b/conf_macros.m4
index 0f1c641..93ac60d 100644
--- a/conf_macros.m4
+++ b/conf_macros.m4
@@ -51,6 +51,18 @@ AC_DEFUN([WITH_TEST_DIR],
AC_DEFINE_UNQUOTED(TEST_DIR, "$with_test_dir", [Directory used for 'make check' temporary files])
])
+AC_ARG_ENABLE([nls],
+ [AS_HELP_STRING([--disable-nls],
+ [do not use Native Language Support])],
+ [use_nls=$enableval],
+ [use_nls=yes])
+if test x"$use_nls" = "xyes"; then
+ HAVE_NLS=1
+ AC_SUBST(HAVE_NLS)
+ AC_DEFINE_UNQUOTED(HAVE_NLS, 1, [Buils with Native Language Support])
+fi
+AM_CONDITIONAL([HAVE_NLS], [test x"$use_nls" = xyes])
+
AC_ARG_ENABLE([all-experimental-features],
[AS_HELP_STRING([--enable-all-experimental-features],
[build all experimental features])],
diff --git a/configure.ac b/configure.ac
index bdc562c..b548506 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,6 +108,20 @@ if test x$HAVE_WBCLIENT != x; then
AM_CHECK_WBCLIENT
fi
+if test x$HAVE_NLS != x; then
+ AC_CHECK_FUNC(dgettext, [],
+ AC_CHECK_LIB(intl, dgettext, [],
+ AC_ERROR([Could not find dgettext() function])))
+ AC_PATH_PROG(MSGFMT, msgfmt)
+ if test x$MSGFMT = x; then
+ AC_ERROR([Could not find msgfmt])
+ fi
+fi
+RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
+# Remove newlines
+LINGUAS=`echo $RAWLINGUAS`
+AC_SUBST(LINGUAS)
+
if test x$HAVE_MANPAGES != x; then
CHECK_XML_TOOLS
CHECK_STYLESHEET([$SGML_CATALOG_FILES],
@@ -125,6 +139,6 @@ abs_build_dir=`pwd`
AC_DEFINE_UNQUOTED([ABS_BUILD_DIR], ["$abs_build_dir"], [Absolute path to the build directory])
AC_SUBST([abs_builddir], $abs_build_dir)
-AC_CONFIG_FILES([Makefile man/Makefile
+AC_CONFIG_FILES([Makefile man/Makefile po/Makefile
contrib/gssntlmssp.spec examples/mech.ntlmssp])
AC_OUTPUT
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1 @@
+
diff --git a/po/Makefile.am b/po/Makefile.am
new file mode 100644
index 0000000..90b5b4a
--- /dev/null
+++ b/po/Makefile.am
@@ -0,0 +1,41 @@
+
+LINGUAS = @LINGUAS@
+MOFILES = $(LINGUAS:%=%.mo)
+POFILES = $(LINGUAS:%=%.po)
+
+noinst_DATA = $(MOFILES)
+
+SUFFIXES = .mo
+
+.po.mo:
+ rm -f && $(MSGFMT) -o $@ $<
+
+clean-local:
+ rm -f $(MOFILES)
+
+install-data-hook: all
+ linguas="$(LINGUAS)"; \
+ for l in $$linguas; do \
+ dir="$(DESTDIR)$(localedir)/$$l/LC_MESSAGES"; \
+ $(mkdir_p) $$dir; \
+ echo Installing $$l.mo to $$dir/$(PACKAGE).mo ; \
+ $(INSTALL_DATA) $$l.mo $$dir/$(PACKAGE).mo; \
+ done
+
+uninstall-hook:
+ linguas="$(LINGUAS)"; \
+ for l in $$linguas; do \
+ file="$(DESTDIR)$(localedir)/$$l/LC_MESSAGES/$(PACKAGE).mo"; \
+ if [ -r "$$file" ]; then \
+ echo "Removing $$file"; rm -f "$$file"; \
+ fi ; \
+ done
+
+# $(PACKAGE).pot is built by a rule in the parent directory Makefile
+# This rule isn't needed but is here for convenience if manually invoked
+.PHONY: $(PACKAGE).pot
+$(PACKAGE).pot:
+ $(MAKE) -C .. po/$@
+
+EXTRA_DIST = $(POFILES) LINGUAS
+DISTCLEANFILES=$(PACKAGE).pot