Make gettext dependency optional

This commit is contained in:
mjentsch 2015-12-05 20:31:08 +01:00
parent 53c6b384ec
commit 0bb5b0121d
3 changed files with 44 additions and 17 deletions

View file

@ -11,6 +11,7 @@ FILE_PERM=0644
CC=@CC@
PKG_CONFIG=@PKG_CONFIG@
MSGFMT_PATH=@MSGFMT_PATH@
DEP=dep
EXE=bin
@ -21,7 +22,9 @@ DIR_LIST=${DEP} ${EXE} ${OBJ} ${LIB}
PLUGIN_OBJECTS=${OBJ}/tgp-net.o ${OBJ}/tgp-timers.o ${OBJ}/msglog.o ${OBJ}/telegram-base.o ${OBJ}/telegram-purple.o ${OBJ}/tgp-2prpl.o ${OBJ}/tgp-structs.o ${OBJ}/tgp-utils.o ${OBJ}/tgp-chat.o ${OBJ}/tgp-ft.o ${OBJ}/tgp-msg.o ${OBJ}/tgp-request.o ${OBJ}/tgp-blist.o
ALL_OBJS=${PLUGIN_OBJECTS}
ifdef MSGFMT_PATH
LOCALES=$(patsubst %.po, %.mo, $(wildcard po/*.po))
endif
.SUFFIXES:
@ -61,7 +64,7 @@ tgl/libs/libtgl.a: tgl/Makefile
+make -C tgl
po/%.mo: po/%.po
msgfmt -cf -o $@ $<
${MSGFMT_PATH} -cf -o $@ $<
${LIB}/libtgl.a: tgl/libs/libtgl.a | create_dirs
cp $< $@
@ -96,11 +99,13 @@ else
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48
install -m $(FILE_PERM) imgs/telegram48.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
endif
ifdef MSGFMT_PATH
@for lang in $(shell cat po/LINGUAS); do \
mkdir -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
echo "installing po/$$lang.mo to $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
install -m $(FILE_PERM) po/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo; \
done
endif
.PHONY: uninstall
uninstall:
@ -111,10 +116,12 @@ uninstall:
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
# TODO: Delete all installed .mo's, no matter what LINGUAS says.
ifdef MSGFMT_PATH
@for lang in $(shell cat po/LINGUAS); do \
echo "removing $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo; \
done
endif
.PHONY: local_install
local_install:

39
configure vendored
View file

@ -621,7 +621,8 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
GETTEXT_PACKAGE
GETTEXT_CHECK
MSGFMT_PATH
CHECK_GETTEXT
PURPLE_CPPFLAGS
LIBOBJS
COPY_ICONS
@ -687,6 +688,7 @@ enable_option_checking
with_zlib
enable_libwebp
enable_icons
enable_translation
'
ac_precious_vars='build_alias
host_alias
@ -1317,6 +1319,7 @@ Optional Features:
useful if you're using Finch of telepathy-haze.
(Adium users shouldn't be using this build system at
all.)
--disable-translation Disable gettext translation
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -4296,15 +4299,22 @@ done
# Extract the first word of "msgfmt", so it can be a program name with args.
# Check whether --enable-translation was given.
if test "${enable_translation+set}" = set; then :
enableval=$enable_translation;
fi
if test "x$enable_translation" != "xno"; then :
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GETTEXT_CHECK+:} false; then :
if ${ac_cv_prog_CHECK_GETTEXT+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$GETTEXT_CHECK"; then
ac_cv_prog_GETTEXT_CHECK="$GETTEXT_CHECK" # Let the user override the test.
if test -n "$CHECK_GETTEXT"; then
ac_cv_prog_CHECK_GETTEXT="$CHECK_GETTEXT" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
@ -4313,7 +4323,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_GETTEXT_CHECK="yes"
ac_cv_prog_CHECK_GETTEXT=""yes""
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -4321,20 +4331,25 @@ done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_CHECK_GETTEXT" && ac_cv_prog_CHECK_GETTEXT=""no""
fi
fi
GETTEXT_CHECK=$ac_cv_prog_GETTEXT_CHECK
if test -n "$GETTEXT_CHECK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GETTEXT_CHECK" >&5
$as_echo "$GETTEXT_CHECK" >&6; }
CHECK_GETTEXT=$ac_cv_prog_CHECK_GETTEXT
if test -n "$CHECK_GETTEXT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECK_GETTEXT" >&5
$as_echo "$CHECK_GETTEXT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test x"$GETTEXT_CHECK" != x"yes" ; then
as_fn_error $? "msgfmt not found please install gettext" "$LINENO" 5
if test x"$CHECK_GETTEXT" != x"yes" ; then
as_fn_error $? "no gettext found, use --disable-translation if you dont need it." "$LINENO" 5
fi
MSGFMT_PATH=$(which msgfmt)
fi
# Define the domain name for the translated words

View file

@ -52,10 +52,15 @@ AC_SUBST(PURPLE_CFLAGS)
AC_SUBST(PURPLE_CPPFLAGS)
AC_SUBST(PURPLE_LIBS)
AC_CHECK_PROG(GETTEXT_CHECK,msgfmt,yes)
if test x"$GETTEXT_CHECK" != x"yes" ; then
AC_MSG_ERROR([msgfmt not found please install gettext])
fi
AC_ARG_ENABLE([translation],
AS_HELP_STRING([--disable-translation], [Disable gettext translation]))
AS_IF([test "x$enable_translation" != "xno"], [
AC_CHECK_PROG(CHECK_GETTEXT, msgfmt, "yes", "no", $PATH)
if test x"$CHECK_GETTEXT" != x"yes" ; then
AC_MSG_ERROR([no gettext found, use --disable-translation if you dont need it.])
fi
AC_SUBST(MSGFMT_PATH, $(which msgfmt))
])
# Define the domain name for the translated words
GETTEXT_PACKAGE=$PACKAGE_NAME