diff --git a/autogen.sh b/autogen.sh index a37064c6a0..4639915bbc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,17 +13,6 @@ ${AUTORECONF:-autoreconf} --verbose --install --force -I m4 ${AUTORECONF_FLAGS} # Customize the INSTALL file rm -f INSTALL && ln -s doc/INSTALL . -# Generate po/POTFILES.in -if ! xgettext -h 2>&1 | grep -- '--keyword' >/dev/null ; then - echo "gettext is unable to extract translations, set XGETTEXT to GNU gettext!" >&2 - touch po/POTFILES.in -else - ${XGETTEXT:-xgettext} --keyword=_ --keyword=N_ --keyword=Q_ --output=- \ - `find . -name '*.[ch]'` | ${SED-sed} -ne '/^#:/{s/#://;s/:[0-9]*/\ -/g;s/ //g;p;}' | \ - grep -v '^$' | sort | uniq >po/POTFILES.in -fi - "$srcdir/version.sh" "$srcdir" if test -x "$srcdir/configure.mc"; then diff --git a/configure.ac b/configure.ac index ae7aafdd32..6d340beadd 100644 --- a/configure.ac +++ b/configure.ac @@ -733,6 +733,10 @@ tests/src/vfs/extfs/helpers-list/misc/Makefile tests/src/vfs/ftpfs/Makefile ]) +AC_CONFIG_COMMANDS_POST([ +"${srcdir}"/po/create-potfiles_in.sh "${srcdir}" +]) + AC_OUTPUT AC_MSG_NOTICE([ diff --git a/po/create-potfiles_in.sh b/po/create-potfiles_in.sh new file mode 100755 index 0000000000..7289a8e96f --- /dev/null +++ b/po/create-potfiles_in.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +if [ -z "$1" ] ;then + echo "usage: $0 " + exit 1 +fi + +cd "$1" && \ + "${FIND:-find}" . -type f -name '*.[ch]' -exec \ + "${GREP:-grep}" -l '_\s*(\s*"' {} + | \ + "${SORT:-sort}" | "${UNIQ:-uniq}" > po/POTFILES.in