summaryrefslogtreecommitdiff
path: root/libgphoto2_port/gphoto-m4
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-31 09:02:20 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2021-12-10 21:47:34 +0100
commitd18b440a72407fc371ec17a2a983976b813e5d97 (patch)
treeefe579a1ef9b0b856da3a7bd27de7a5cd03fb7c5 /libgphoto2_port/gphoto-m4
parentb2d8e106ae31b59e0ec9ecf9534376f97b9dbe1c (diff)
downloadlibgphoto2-d18b440a72407fc371ec17a2a983976b813e5d97.tar.gz
Require gettext >= 0.18.3; remove GP_GETTEXT_HACK
This requires gettext version 0.18.3 or later, and it removes the GP_GETTEXT_HACK which used to generate a po/Makevars file from the po/Makevers.template. gettext 0.18.3 is the same gettext version requirement as libexif uses. gettext 0.18.3 has been released 2013-07-07, which is a similar timeframe of the autoconf, automake and libtool releases we require. If you ever need to build a post 2021 libgphoto2 from git on a system with pre 0.18.3 gettext, you can can always prepare a tarball using "make dist" on a system with gettext 0.18.3 or later, and build that tarball on the older machine. Not generating the po/Makevars file any more means that we need additional consistency checks for the parts of po/Makevars which cannot be derived from the Autoconf standard set of AC_SUBST()ed Makefile.in variables.
Diffstat (limited to 'libgphoto2_port/gphoto-m4')
-rw-r--r--libgphoto2_port/gphoto-m4/Makefile-files2
-rw-r--r--libgphoto2_port/gphoto-m4/gp-gettext-hack.m482
-rw-r--r--libgphoto2_port/gphoto-m4/gp-gettext-setup.m4101
3 files changed, 102 insertions, 83 deletions
diff --git a/libgphoto2_port/gphoto-m4/Makefile-files b/libgphoto2_port/gphoto-m4/Makefile-files
index 6bc234866..a623da9c3 100644
--- a/libgphoto2_port/gphoto-m4/Makefile-files
+++ b/libgphoto2_port/gphoto-m4/Makefile-files
@@ -14,7 +14,7 @@ EXTRA_DIST += %reldir%/gp-check-shell-environment.m4
EXTRA_DIST += %reldir%/gp-config-msg.m4
EXTRA_DIST += %reldir%/gp-documentation.m4
EXTRA_DIST += %reldir%/gp-driverdir.m4
-EXTRA_DIST += %reldir%/gp-gettext-hack.m4
+EXTRA_DIST += %reldir%/gp-gettext-setup.m4
EXTRA_DIST += %reldir%/gp-internal-docs.m4
EXTRA_DIST += %reldir%/gp-libjpeg.m4
EXTRA_DIST += %reldir%/gp-libltdl.m4
diff --git a/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 b/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4
deleted file mode 100644
index 01ca92742..000000000
--- a/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4
+++ /dev/null
@@ -1,82 +0,0 @@
-dnl
-dnl GP_GETTEXT_HACK
-dnl
-dnl gettext hack, originally designed for libexif, libgphoto2, and Co.
-dnl This creates a po/Makevars file with adequate values if the
-dnl po/Makevars.template is present.
-dnl
-dnl Example usage:
-dnl GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}],
-dnl [Copyright Holder],
-dnl [foo-translation@example.org])
-dnl ALL_LINGUAS="de es fr"
-dnl AM_GNU_GETTEXT_VERSION([0.14.1])
-dnl AM_GNU_GETTEXT([external])
-dnl AM_PO_SUBDIRS()
-dnl AM_ICONV()
-dnl GP_GETTEXT_FLAGS
-dnl
-dnl You can leave out the GP_GETTEXT_HACK parameters if you want to,
-dnl GP_GETTEXT_HACK will try fall back to sensible values in that case:
-dnl
-dnl
-AC_DEFUN([GP_GETTEXT_HACK], [dnl
-AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl
-AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl
-m4_if([$2],[],[$1="${PACKAGE_TARNAME}"],[$1="$2"])
-AC_DEFINE_UNQUOTED([$1], ["${$1}"],
- [The gettext domain we're using])
-AC_SUBST([$1])
-sed_cmds="s|^DOMAIN.*|DOMAIN = ${$1}|"
-m4_if([$3],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $3|"])
-m4_ifval([$4],[
-if test -n "$PACKAGE_BUGREPORT"; then
- sed_mb="${PACKAGE_BUGREPORT}"
-else
- m4_pattern_allow([GP_GETTEXT_HACK])dnl
- AC_MSG_ERROR([
-*** Your configure.{ac,in} is wrong.
-*** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax)
-*** or give [GP_GETTEXT_HACK] the third parameter.
-***
-])
-fi
-],[
-sed_mb="$4"
-])
-sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|"
-# Not so sure whether this hack is all *that* evil...
-AC_MSG_CHECKING([for po/Makevars requiring hack])
-if test -f "${srcdir}/po/Makevars.template"; then
- sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars"
- AC_MSG_RESULT([yes, done.])
-else
- AC_MSG_RESULT([no])
-fi
-])dnl
-dnl
-dnl
-dnl
-AC_DEFUN([GP_GETTEXT_FLAGS],
-[
-AC_REQUIRE([AM_GNU_GETTEXT])
-AC_REQUIRE([GP_CONFIG_INIT])
-if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then
- AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl"
-fi
-GP_CONFIG_MSG([Use translations],[${USE_NLS}])
-if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then
- GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}])
-fi
-])dnl
-dnl
-dnl
-
-dnl Please do not remove this:
-dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81
-dnl I use this to find all the different instances of this file which
-dnl are supposed to be synchronized.
-
-dnl Local Variables:
-dnl mode: autoconf
-dnl End:
diff --git a/libgphoto2_port/gphoto-m4/gp-gettext-setup.m4 b/libgphoto2_port/gphoto-m4/gp-gettext-setup.m4
new file mode 100644
index 000000000..a73341437
--- /dev/null
+++ b/libgphoto2_port/gphoto-m4/gp-gettext-setup.m4
@@ -0,0 +1,101 @@
+dnl ####################################################################
+dnl GP_GETTEXT_SETUP(...)
+dnl Gettext setup with e.g. consistency checks for value of DOMAIN.
+dnl ####################################################################
+dnl
+dnl Usage:
+dnl GP_GETTEXT_SETUP([DOMAIN_LIBGPHOTO2],
+dnl [libgphoto2-${LIBGPHOTO2_CURRENT_MIN}],
+dnl [po])
+dnl GP_GETTEXT_SETUP([DOMAIN_LIBGPHOTO2_PORT],
+dnl [libgphoto2_port-${LIBGPHOTO2_PORT_CURRENT_MIN}],
+dnl [libgphoto2_port/po])
+dnl
+dnl with the corresponding top level Makefile.am containing
+dnl
+dnl @GP_GETTEXT_SETUP_MK@
+dnl
+dnl # Dummy target to force Automake to make the "all" target depend on it
+dnl all-local:
+dnl @:
+dnl
+dnl # Dummy target to force Automake to make the "distclean" target depend on it
+dnl distclean-local:
+dnl @:
+dnl
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_GETTEXT_SETUP], [dnl
+AC_REQUIRE([AC_PROG_GREP])dnl
+AC_REQUIRE([GP_GETTEXT_SETUP_INIT])dnl
+dnl
+AC_MSG_CHECKING([translation text domain symbol])
+AC_MSG_RESULT([$1])
+AC_MSG_CHECKING([translation text domain value])
+AC_MSG_RESULT([$2])
+AC_MSG_CHECKING([translation subdirectory])
+AC_MSG_RESULT([$3])
+dnl
+dnl The text domain can be evaluated as a shell variable, no need for
+dnl recursive make variable evaluation, so we can put the text domain
+dnl into the include file and do not need to define it from a make
+dnl rule on the compiler command line.
+AC_DEFINE_UNQUOTED([$1], ["$2"], [text domain for string translations])
+dnl AM_CPPFLAGS="$AM_CPPFLAGS -D$1=\\\""'$2'"\\\""
+dnl AC_SUBST([$1], [$2])
+dnl
+dnl
+dnl The following check will have "make all" print something like
+dnl DOMAIN = libgphoto2-6
+dnl if the consistency check has been successful, and have "make all" abort
+dnl Error: Inconsistent values for GETTEXT_PACKAGE_LIBGPHOTO2 and po/Makevars DOMAIN.
+dnl if the consistency check has failed.
+dnl
+cat >>${GP_GETTEXT_SETUP_MK} <<EOF
+ @if \$(GREP) '^DOMAIN *= *$2\$\$' \`test -f '$3/Makevars' || echo '\$(srcdir)/'\`'$3/Makevars'; then :; else echo 'Error: Inconsistent values for $1 and po/Makevars DOMAIN'; exit 1; fi
+EOF
+dnl
+])dnl
+dnl
+dnl
+dnl ####################################################################
+dnl Setup for the po subdir specific setup
+dnl ####################################################################
+dnl
+AC_DEFUN_ONCE([GP_GETTEXT_SETUP_INIT], [dnl
+AC_BEFORE([$0], [GP_GETTEXT_SETUP])dnl
+dnl
+dnl The LOCALEDIR definition contains too many levels of recursive
+dnl make variable definitions to evaluate via shell, so we have make
+dnl resolve that instead of the shell configure script.
+AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\""'${localedir}'"\\\""
+dnl
+dnl
+AC_SUBST_FILE([GP_GETTEXT_SETUP_MK])
+GP_GETTEXT_SETUP_MK="gp-gettext-setup.mk"
+dnl
+dnl
+cat >${GP_GETTEXT_SETUP_MK} <<EOF
+
+# ${GP_GETTEXT_SETUP_MK} autogenerated by $0
+
+distclean-local: distclean-local-gp-gettext-setup
+.PHONY: distclean-local-gp-gettext-setup
+distclean-local-gp-gettext-setup:
+ -rm -f ${GP_GETTEXT_SETUP_MK}
+
+all-local: all-local-gp-gettext-setup
+.PHONY: all-local-gp-gettext-setup
+all-local-gp-gettext-setup:
+ @:
+EOF
+dnl
+dnl
+])dnl
+dnl
+dnl
+dnl ####################################################################
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End: