summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2023-10-06 08:09:54 (EDT)
committer P. J. McDermott <pj@pehjota.net>2023-10-06 09:05:28 (EDT)
commit84a56a1f46e1c09775f533a5f335ddebdd74c92f (patch)
treed2cf90e22b7498abe98fdbffa66b595066e8b80c
parent89b67a868e2023d41a29609c2fa186174e634952 (diff)
downloadatsign-84a56a1f46e1c09775f533a5f335ddebdd74c92f.zip
atsign-84a56a1f46e1c09775f533a5f335ddebdd74c92f.tar.gz
atsign-84a56a1f46e1c09775f533a5f335ddebdd74c92f.tar.bz2
build: gettextize
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am4
-rwxr-xr-xautogen.sh10
-rw-r--r--configure.ac8
-rw-r--r--m4/.gitignore8
-rw-r--r--po/.gitignore11
-rw-r--r--po/Makevars26
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/i18n.h11
-rw-r--r--src/local.mk1
10 files changed, 80 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 0084077..3c7427f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,8 @@
*~
*.orig
-# Files generated by aclocal, autoconf, and automake
+# Files generated by gettextize, aclocal, autoconf, and automake
+/ABOUT-NLS
/aclocal.m4
/autom4te.cache/
/configure
diff --git a/Makefile.am b/Makefile.am
index 0e8124d..9ea4f18 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -63,7 +63,7 @@ atsign_LINK = $(LINK) version.c
EXTRA_atsign_DEPENDENCIES = version.c
CLEANFILES = version.c
CONFIG_CLEAN_FILES =
-EXTRA_DIST = autogen.sh
+EXTRA_DIST = build-aux/config.rpath autogen.sh
V_REDIR = $(V_REDIR_$(V))
V_REDIR_ = $(V_REDIR_$(AM_DEFAULT_VERBOSITY))
@@ -151,3 +151,5 @@ release:
include $(top_srcdir)/src/local.mk
include $(top_srcdir)/tests/local.mk
+
+SUBDIRS = . po
diff --git a/autogen.sh b/autogen.sh
index c80fde1..1123075 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,7 +2,7 @@
#
# Script to generate the build system.
#
-# Copyright (C) 2013 P. J. McDermott
+# Copyright (C) 2013, 2019 P. J. McDermott
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
@@ -19,6 +19,14 @@ srcdir="${0%/*}"
cat >ChangeLog <<-EOF
This file is generated upon release. Run \`git log\` for a list of changes.
EOF
+ # Force gettextize to be non-interactive. Stupid but necessary.
+ LC_ALL=C expect -f - <<-EOF
+ spawn gettextize --force --no-changelog
+ expect "Press Return to acknowledge the previous * paragraphs."
+ send "\n"
+ EOF
+ # This file contains a huge outdated matrix of unrelated packages.
+ >ABOUT-NLS
aclocal
autoconf
autoheader
diff --git a/configure.ac b/configure.ac
index 6578718..a42b73e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,12 @@ AM_CONDITIONAL([OUT_OF_TREE], [test x"${srcdir}" != x'.' ])
AM_CONDITIONAL([CROSS_COMPILING], [! test x"${build_alias}" = x"${host_alias}"])
+GETTEXT_PACKAGE="${PACKAGE}"
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"],
+ [Define the gettext package to be used.])
+AM_GNU_GETTEXT([external])
+
save_CFLAGS="${CFLAGS-}"
AC_PROG_CC()
AM_PROG_CC_C_O()
@@ -155,6 +161,6 @@ for flag in -Os -fno-unwind-tables -fno-asynchronous-unwind-tables \
AX_CHECK_COMPILE_FLAG([${flag}], [AX_APPEND_FLAG([${flag}])])
done
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile po/Makefile.in])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT()
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..c7e2124
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,8 @@
+/gettext.m4
+/iconv.m4
+/lib-ld.m4
+/lib-link.m4
+/lib-prefix.m4
+/nls.m4
+/po.m4
+/progtest.m4
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..532f823
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,11 @@
+/Makefile.in.in
+/Makevars.template
+/Rules-quot
+/*.sed
+/POTFILES
+/*.pot
+/*.po
+/*.mo
+/*@boldquot.header
+/*@quot.header
+/stamp-po
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..1753e43
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,26 @@
+# Variables to be inserted into Makefile
+
+DOMAIN = $(PACKAGE)
+
+subdir = po
+top_builddir = ..
+
+XGETTEXT_OPTIONS = --add-comments=TRANSLATORS --keyword=_
+
+COPYRIGHT_HOLDER = P. J. McDermott
+
+PACKAGE_GNU = no
+
+MSGID_BUGS_ADDRESS = mailto:pj@pehjota.net
+
+EXTRA_LOCALE_CATEGORIES =
+
+USE_MSGCTXT = no
+
+MSGMERGE_OPTIONS =
+
+MSGINIT_OPTIONS =
+
+PO_DEPENDS_ON_POT = yes
+
+DIST_DEPENDS_ON_UPDATE_PO = yes
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..5472064
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,2 @@
+src/datetime.c
+src/main.c
diff --git a/src/i18n.h b/src/i18n.h
new file mode 100644
index 0000000..4d8ee76
--- /dev/null
+++ b/src/i18n.h
@@ -0,0 +1,11 @@
+#ifdef ENABLE_NLS
+
+#include <libintl.h>
+
+#define _(msgid) gettext(msgid)
+
+#else
+
+#define _(msgid) (msgid)
+
+#endif
diff --git a/src/local.mk b/src/local.mk
index 3ce2029..1012945 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -2,4 +2,5 @@ atsign_SOURCES += \
%reldir%/datetime.c \
%reldir%/datetime.h \
%reldir%/formats.h \
+ %reldir%/i18n.h \
%reldir%/main.c