diff --git a/.gitignore b/.gitignore index 2e20e98e..209c4e78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +*.lo +*.o +*.so +.deps +.libs +ABOUT-NLS aclocal.m4 autom4te.cache compile @@ -5,24 +11,22 @@ config.guess config.h config.h.in config.log +config.rpath config.status config.sub configure depcomp -.deps -.libs free INSTALL install-sh kill libtool -*.lo ltmain.sh m4/ Makefile Makefile.in missing -*.o +mkinstalldirs pgrep pkill pmap @@ -39,7 +43,6 @@ pwdx skill slabtop snice -*.so stamp-h1 sysctl tload diff --git a/Makefile.am b/Makefile.am index 3c5be856..4de7863f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,11 @@ -AM_CPPFLAGS = -include $(top_builddir)/config.h +AM_CPPFLAGS = -include $(top_builddir)/config.h -I$(top_srcdir)/include ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = proc ps testsuite +SUBDIRS = \ + po \ + proc \ + ps \ + testsuite AM_CFLAGS = -Iproc AM_LDFLAGS = ./proc/libprocfs.la diff --git a/autogen.sh b/autogen.sh index b42f57b6..4e3d4995 100755 --- a/autogen.sh +++ b/autogen.sh @@ -54,6 +54,13 @@ echo " libtoolize: $(libtoolize --version | head -1)" rm -rf autom4te.cache set -e +po/update-potfiles +autopoint --force $AP_OPTS +if ! grep -q datarootdir po/Makefile.in.in; then + echo autopoint does not honor dataroot variable, patching. + sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\ +datadir = @datadir@/g' po/Makefile.in.in +fi libtoolize --force ${LT_OPTS} aclocal -I m4 ${AL_OPTS} autoconf ${AC_OPTS} diff --git a/configure.ac b/configure.ac index 63a3c37a..08024186 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,32 @@ AC_CHECK_FUNCS([\ wcwidth ]) +usrbin_execdir='${exec_prefix}/usr/bin' +AC_SUBST([usrbin_execdir]) + +AM_GNU_GETTEXT_VERSION([0.14.1]) +AM_GNU_GETTEXT([external]) +dnl if test -d "$srcdir/po" +dnl then +dnl ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'` +dnl else +dnl ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu" +dnl fi + +dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1])) +dnl The VARSUFFIX is optional and overrides the default behaviour. For example: +dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX +dnl UTIL_CHECK_LIB(yyy, func) generates have_yyy and HAVE_LIBYYY +dnl --------------------------------- +AC_DEFUN([UTIL_CHECK_LIB], [ + m4_define([suffix], m4_default([$3],$1)) + [have_]suffix=yes + m4_ifdef([$3], + [AC_CHECK_LIB([$1], [$2], [AC_DEFINE(AS_TR_CPP([HAVE_LIB]suffix), 1)], [[have_]suffix=no])], + [AC_CHECK_LIB([$1], [$2], [], [[have_]suffix=no])]) + AM_CONDITIONAL(AS_TR_CPP([HAVE_]suffix), [test [$have_]suffix = yes]) +]) + AC_ARG_WITH([ncurses], AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]), [with_ncurses=no], [with_ncurses=yes] @@ -168,6 +194,7 @@ AC_SUBST(DEJAGNU) AC_CONFIG_FILES([ Makefile +po/Makefile.in proc/Makefile proc/libprocfs.pc ps/Makefile diff --git a/include/nls.h b/include/nls.h new file mode 100644 index 00000000..be2114ee --- /dev/null +++ b/include/nls.h @@ -0,0 +1,106 @@ +#ifndef PROCPS_NG_NLS_H +#define PROCPS_NG_NLS_H + +#ifndef LOCALEDIR +#define LOCALEDIR "/usr/share/locale" +#endif + +#ifdef HAVE_LOCALE_H +# include +#else +# undef setlocale +# define setlocale(Category, Locale) /* empty */ +#endif + +#ifdef ENABLE_NLS +# include +# define _(Text) gettext (Text) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +# define P_(Singular, Plural, n) ngettext (Singular, Plural, n) +#else +# undef bindtextdomain +# define bindtextdomain(Domain, Directory) /* empty */ +# undef textdomain +# define textdomain(Domain) /* empty */ +# define _(Text) (Text) +# define N_(Text) (Text) +# define P_(Singular, Plural, n) ((n) == 1 ? (Singular) : (Plural)) +#endif /* ENABLE_NLS */ + +#ifdef HAVE_LANGINFO_H +# include +#else + +typedef int nl_item; +extern char *langinfo_fallback(nl_item item); + +# define nl_langinfo langinfo_fallback + +enum { + CODESET = 1, + RADIXCHAR, + THOUSEP, + D_T_FMT, + D_FMT, + T_FMT, + T_FMT_AMPM, + AM_STR, + PM_STR, + + DAY_1, + DAY_2, + DAY_3, + DAY_4, + DAY_5, + DAY_6, + DAY_7, + + ABDAY_1, + ABDAY_2, + ABDAY_3, + ABDAY_4, + ABDAY_5, + ABDAY_6, + ABDAY_7, + + MON_1, + MON_2, + MON_3, + MON_4, + MON_5, + MON_6, + MON_7, + MON_8, + MON_9, + MON_10, + MON_11, + MON_12, + + ABMON_1, + ABMON_2, + ABMON_3, + ABMON_4, + ABMON_5, + ABMON_6, + ABMON_7, + ABMON_8, + ABMON_9, + ABMON_10, + ABMON_11, + ABMON_12, + + ERA_D_FMT, + ERA_D_T_FMT, + ERA_T_FMT, + ALT_DIGITS, + CRNCYSTR, + YESEXPR, + NOEXPR +}; + +#endif /* !HAVE_LANGINFO_H */ +#endif /* PROCPS_NG_NLS_H */ diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 00000000..7e029c56 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,18 @@ +*.gmo +boldquot.sed +en@boldquot.header +en@quot.header +insert-header.sin +Makefile +Makefile.in +Makefile.in.in +Makefile.in.in~ +Makevars.template +POTFILES +POTFILES.in +procps-ng.pot +quot.sed +remove-potcdate.sed +remove-potcdate.sin +Rules-quot +stamp-po diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 00000000..daa42e2b --- /dev/null +++ b/po/Makevars @@ -0,0 +1,41 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2 + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Free Software Foundation, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = procps@freelists.org + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/update-potfiles b/po/update-potfiles new file mode 100755 index 00000000..70af4ec0 --- /dev/null +++ b/po/update-potfiles @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ ! -f "po/Makevars" ]; then + echo "You must run this script in the top-level directory" + exit 1 +fi + +find . -name '*.c' | + sort | + sed 's|^./|| +/^contrib/d' > po/POTFILES.in