configure.ac or configure.in - this is the source from which
autoconf generates the configure script.
PACKAGE=gettext
VERSION=0.18.2
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
or, if you are using GNU automake, by a line like this:
AM_INIT_AUTOMAKE(gettext, 0.18.2)
Of course, you replace ‘gettext’ with the name of your package,
and ‘0.18.2’ by its version numbers, exactly as they
should appear in the packaged tar file name of your distribution
(gettext-0.18.2.tar.gz, here).
Here is the main m4 macro for triggering internationalization
support. Just add this line to configure.ac:
AM_GNU_GETTEXT
This call is purposely simple, even if it generates a lot of configure time checking and actions.
If you have suppressed the intl/ subdirectory by calling
gettextize without ‘--intl’ option, this call should read
AM_GNU_GETTEXT([external])
The AC_OUTPUT directive, at the end of your configure.ac
file, needs to be modified in two ways:
AC_OUTPUT([existing configuration files intl/Makefile po/Makefile.in],
[existing additional actions])
The modification to the first argument to AC_OUTPUT asks
for substitution in the intl/ and po/ directories.
Note the ‘.in’ suffix used for po/ only. This is because
the distributed file is really po/Makefile.in.in.
If you have suppressed the intl/ subdirectory by calling
gettextize without ‘--intl’ option, then you don't need to
add intl/Makefile to the AC_OUTPUT line.
If, after doing the recommended modifications, a command like ‘aclocal -I m4’ or ‘autoconf’ or ‘autoreconf’ fails with a trace similar to this:
configure.ac:44: warning: AC_COMPILE_IFELSE was called before AC_GNU_SOURCE
../../lib/autoconf/specific.m4:335: AC_GNU_SOURCE is expanded from...
m4/lock.m4:224: gl_LOCK is expanded from...
m4/gettext.m4:571: gt_INTL_SUBDIR_CORE is expanded from...
m4/gettext.m4:472: AM_INTL_SUBDIR is expanded from...
m4/gettext.m4:347: AM_GNU_GETTEXT is expanded from...
configure.ac:44: the top level
configure.ac:44: warning: AC_RUN_IFELSE was called before AC_GNU_SOURCE
you need to add an explicit invocation of ‘AC_GNU_SOURCE’ in the configure.ac file - after ‘AC_PROG_CC’ but before ‘AM_GNU_GETTEXT’, most likely very close to the ‘AC_PROG_CC’ invocation. This is necessary because of ordering restrictions imposed by GNU autoconf.