prettier config msg output
[platform/upstream/libexif.git] / m4m / gp-gettext-hack.m4
1 dnl
2 dnl GP_GETTEXT_HACK
3 dnl
4 dnl gettext hack, originally designed for libexif, libgphoto2, and Co.
5 dnl This creates a po/Makevars file with adequate values if the
6 dnl po/Makevars.template is present.
7 dnl
8 dnl Example usage:
9 dnl    GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}],
10 dnl                    [Copyright Holder],
11 dnl                    [foo-translation@example.org])
12 dnl    ALL_LINGUAS="de es fr"
13 dnl    AM_GNU_GETTEXT_VERSION([0.14.1])
14 dnl    AM_GNU_GETTEXT([external])
15 dnl    AM_PO_SUBDIRS()
16 dnl    AM_ICONV()
17 dnl    GP_GETTEXT_FLAGS
18 dnl
19 dnl You can leave out the GP_GETTEXT_HACK parameters if you want to,
20 dnl GP_GETTEXT_HACK will try fall back to sensible values in that case:
21 dnl
22
23 AC_DEFUN([GP_GETTEXT_HACK],
24 [
25 AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl
26 AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl
27 m4_if([$1],[],[GETTEXT_PACKAGE="${PACKAGE_TARNAME}"],[GETTEXT_PACKAGE="$1"])
28 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
29                    [The gettext domain we're using])
30 AC_SUBST([GETTEXT_PACKAGE])
31 sed_cmds="s|^DOMAIN.*|DOMAIN = ${GETTEXT_PACKAGE}|"
32 m4_if([$2],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $2|"])
33 m4_if([$3],[],[if test -n "$PACKAGE_BUGREPORT"; then
34    sed_mb="${PACKAGE_BUGREPORT}"
35 else
36    AC_MSG_ERROR([
37 *** Your configure.{ac,in} is wrong.
38 *** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax)
39 *** or give [GP_GETTEXT_HACK] the second parameter.
40 ***
41 ])
42 fi],[sed_mb="$3"])
43 sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|"
44 # Not so sure whether this hack is all *that* evil...
45 AC_MSG_CHECKING([for po/Makevars requiring hack])
46 if test -f "${srcdir}/po/Makevars.template"; then
47    sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars"
48    AC_MSG_RESULT([yes, done.])
49 else
50    AC_MSG_RESULT([no])
51 fi
52 ])
53
54 AC_DEFUN([GP_GETTEXT_FLAGS],
55 [
56 AC_REQUIRE([AM_GNU_GETTEXT])
57 AC_REQUIRE([GP_CONFIG_MSG])
58 if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then
59    AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl"
60 fi
61 GP_CONFIG_MSG
62 GP_CONFIG_MSG([Use translations],[${USE_NLS}])
63 if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then
64    GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}])
65 fi
66 ])
67
68 dnl Please do not remove this:
69 dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81
70 dnl I use this to find all the different instances of this file which 
71 dnl are supposed to be synchronized.
72
73 dnl Local Variables:
74 dnl mode: autoconf
75 dnl End: