From 1767ffb39d9e044772c85959e027570b9f6d6fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Thu, 27 Aug 2015 10:47:23 +0000 Subject: [PATCH] added translation files --- ax_check_qt.m4 | 28 +++------- ax_init_standard_project.m4 | 104 +++++++++++++++++++++++++++++++++--- bootstrap.sh | 19 +++++-- configure.ac | 1 + proxyface.spec.in | 1 + src/languages.qrc.in | 9 ++++ src/makefile.am | 15 +++++- 7 files changed, 146 insertions(+), 31 deletions(-) create mode 100644 src/languages.qrc.in diff --git a/ax_check_qt.m4 b/ax_check_qt.m4 index 91c0072..d211212 100644 --- a/ax_check_qt.m4 +++ b/ax_check_qt.m4 @@ -38,6 +38,7 @@ AC_DEFUN([AX_CXX_QT_TOOL], [ + PKG_PROG_PKG_CONFIG if test -z "$HAVE_$1"; then HAVE_$1=1 AC_MSG_CHECKING([for $2]) @@ -61,7 +62,7 @@ AC_DEFUN([AX_CXX_QT_TOOL], [ fi fi AC_SUBST($1) - AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) + AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1) if test $HAVE_$1 -eq 1; then AC_MSG_RESULT([$$1]) else @@ -79,24 +80,6 @@ AC_DEFUN([AX_CXX_QT_TOOLS], [ AX_CXX_QT_TOOL(LRELEASE, lrelease) ]) -AC_DEFUN([AX_CHECK_VALID_FLAG], [ - AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])]) - save_cppflags="$CPPFLAGS" - newflag="no" - for test_flag in $1; do - CPPFLAGS+=" ${test_flag}" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ - newflag="$test_flag" - CPPFLAGS="$save_cppflags" - CPPFLAGS+=" ${test_flag}" - break; - ]) - CPPFLAGS="$save_cppflags" - done - AC_SUBST(CPPFLAGS) - AC_MSG_RESULT([$newflag]) -]) - AC_DEFUN([AX_CHECK_QT], [ qt_modules="$2" qt_modules_optional="$3" @@ -148,8 +131,11 @@ AC_DEFUN([AX_CHECK_QT], [ fi ], [HAVE_$1=0]) ]) - AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) - AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag]) + AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1) + AX_CHECK_VALID_CXX_FLAG([-fPIC -fPIE], [position independent code flag]) + if test "${MINGW}" != "no"; then + AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag]) + fi AC_SUBST(QTDIR) AC_SUBST(QT_PLUGIN_PATH) AC_SUBST(CPPFLAGS) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 0db6a35..c4a6f7e 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -250,10 +250,10 @@ EOF # use this in configure.ac to support HTML data for webservers AC_DEFUN([AX_BUILD_HTML], [ AC_CONFIG_FILES([html/makefile]) - AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-example-targets], [html/makefile.in]) - test -f html/makefile.in && cat >> examples/html.in <> html/makefile.in < /dev/null); do if test -f "$f"; then $1_found=${tmp_package} $1_CFLAGS+=" -I${f%/*}" @@ -446,7 +446,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [ tmp_includedir=$(${PKG_CONFIG} --variable=includedir $tmp_package) for x in ${tmp_includedir}; do AC_MSG_NOTICE([search for $3 in $x]) - for f in $(find ${x} -name "$3"); do + for f in $(find ${x} -name "$3" 2> /dev/null); do if test -f "$f"; then $1_found=${tmp_package} $1_CFLAGS+=" -I${f%/*}" @@ -501,7 +501,7 @@ AC_DEFUN([AX_PKG_CHECK], [ ], [ HAVE_$1=0 ]) - AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) + AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1) AC_SUBST(HAVE_$1) AC_SUBST(CPPFLAGS) AC_SUBST(CXXFLAGS) @@ -532,3 +532,95 @@ AC_DEFUN([AX_REQUIRE_HEADER], [ ], []) ], []) ]) + +# Check within a list of CPP-Flags for the first that is usable and +# configure it +# - parameter: +# $1 = white-space separated list of alternative flags +# $2 = module name (optional, if different from id) +AC_DEFUN([AX_CHECK_VALID_CPP_FLAG], [ + AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])]) + save_cppflags="$CPPFLAGS" + newflag="no" + for test_flag in $1; do + CPPFLAGS+=" ${test_flag}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ + newflag="$test_flag" + CPPFLAGS="$save_cppflags" + CPPFLAGS+=" ${test_flag}" + break; + ]) + CPPFLAGS="$save_cppflags" + done + AC_SUBST(CPPFLAGS) + AC_MSG_RESULT([$newflag in $CPPFLAGS]) +]) + +# Check within a list of CXX-Flags for the first that is usable and +# configure it +# - parameter: +# $1 = white-space separated list of alternative flags +# $2 = module name (optional, if different from id) +AC_DEFUN([AX_CHECK_VALID_CXX_FLAG], [ + AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])]) + save_cxxflags="$CXXFLAGS" + newflag="no" + for test_flag in $1; do + CXXFLAGS+=" ${test_flag}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ + newflag="$test_flag" + CXXFLAGS="$save_cxxflags" + CXXFLAGS+=" ${test_flag}" + break; + ]) + CXXFLAGS="$save_cxxflags" + done + AC_SUBST(CXXFLAGS) + AC_MSG_RESULT([$newflag in $CXXFLAGS]) +]) + +# Check within a list of C-Flags for the first that is usable and +# configure it +# - parameter: +# $1 = white-space separated list of alternative flags +# $2 = module name (optional, if different from id) +AC_DEFUN([AX_CHECK_VALID_C_FLAG], [ + AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])]) + save_cflags="$CFLAGS" + newflag="no" + for test_flag in $1; do + CFLAGS+=" ${test_flag}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ + newflag="$test_flag" + CFLAGS="$save_cflags" + CFLAGS+=" ${test_flag}" + break; + ]) + CFLAGS="$save_cflags" + done + AC_SUBST(CFLAGS) + AC_MSG_RESULT([$newflag in $CFLAGS]) +]) + +# Check within a list of LD-Flags for the first that is usable and +# configure it +# - parameter: +# $1 = white-space separated list of alternative flags +# $2 = module name (optional, if different from id) +AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [ + AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])]) + save_ldflags="$LDFLAGS" + newflag="no" + for test_flag in $1; do + LDFLAGS+=" ${test_flag}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ + newflag="$test_flag" + LDFLAGS="$save_ldflags" + LDFLAGS+=" ${test_flag}" + break; + ]) + LDFLAGS="$save_ldflags" + done + AC_SUBST(LDFLAGS) + AC_MSG_RESULT([$newflag in $LDFLAGS]) +]) diff --git a/bootstrap.sh b/bootstrap.sh index 41f1f4e..418957e 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -105,6 +105,8 @@ GENERATED FILES * ax_check_qt.m4 - auxiliary macro definition file * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle * AUTHORS - replace your name in AUTHORS before first run + * NEWS - empty file add your project's news + * README - add project description (first line is header, followed by an empty line) * configure.ac - global configuration file template * makefile.am - global makefile template * src/makefile.am - if you enabled AX_USE_CXX @@ -149,6 +151,7 @@ FILES TO EDIT The following files normally require editing: * AUTHORS + * NEWS * README * configure.ac * src/makefile.am @@ -178,6 +181,7 @@ FILES * AUTHORS: First line is the main author and used in Debian and RPM packaging, so there must be a GPG key that matches to this line. + * NEWS: File to add project news. * README: First line is a short description of your project, then an empty line must follow. All remaining lines are a long description of your project. this information @@ -388,6 +392,14 @@ fi to AUTHORS < + + + @top_srcdir@/src/proxy_de.qm + @top_srcdir@/src/proxy_fr.qm + @top_srcdir@/src/proxy_it.qm + @top_srcdir@/src/proxy_en.qm + + diff --git a/src/makefile.am b/src/makefile.am index 3654993..9e70e16 100644 --- a/src/makefile.am +++ b/src/makefile.am @@ -7,6 +7,12 @@ ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 lib_LTLIBRARIES = libproxyface.la +LANGUAGE_FILE_BASE = proxy +translationsdir = ${pkgdatadir}/translations +translations_DATA = ${LANGUAGE_FILE_BASE}_en.qm \ + ${LANGUAGE_FILE_BASE}_de.qm \ + ${LANGUAGE_FILE_BASE}_fr.qm \ + ${LANGUAGE_FILE_BASE}_it.qm proxyfacedir = ${includedir}/proxyface proxyface_HEADERS = proxyface/autoproxy.hxx proxyface/proxy.hxx \ @@ -23,7 +29,14 @@ libproxyface_la_MOCFILES = proxyface/moc_proxy.cxx \ libproxyface_la_RCCFILES = proxyface/qrc_resources.cxx BUILT_SOURCES = ${libproxyface_la_UIFILES} \ ${libproxyface_la_MOCFILES} \ - ${libproxyface_la_RCCFILES} + ${libproxyface_la_RCCFILES} ${translations_DATA} +EXTRA_DIST_TR = ${libproxyface_la_MOCFILES:moc_%.cxx=%.hxx} \ + ${libproxyface_la_UIFILES:ui_%.hxx=%.ui} +EXTRA_DIST = ${EXTRA_DIST_TR} languages.qrc.in \ + ${translations_DATA:%.qm=%.ts} + endif libproxyface_la_SOURCES = version.cxx ${libproxyface_la_RCCFILES} \ ${libproxyface_la_MOCFILES} + +DISTCLEANFILES = ${translations_DATA} \ No newline at end of file