# # # add_file "m4/portable-gettext.m4" # content [f8d7d4442b94568f4922764b17c1bbe4c46e4f20] # # patch "configure.ac" # from [a25c3ddbcfadba2cad2219c840f3e8b30d12e8e4] # to [bf94d1c9529642c33f3a46bb8636a2a02bed6b5e] # ============================================================ --- m4/portable-gettext.m4 f8d7d4442b94568f4922764b17c1bbe4c46e4f20 +++ m4/portable-gettext.m4 f8d7d4442b94568f4922764b17c1bbe4c46e4f20 @@ -0,0 +1,107 @@ +dnl @synopsis PG_NLS_FRAMEWORK +dnl +dnl @summary provide --disable-nls to the user +dnl +dnl This macro sets $enable_nls to "yes" if user didn't disable NLS support +dnl and provides ENABLE_NLS in config.h +dnl +dnl @category UserOptions +dnl @author Patrick Georgi +dnl @version 2007-03-10 +dnl @license MIT + +AC_DEFUN([PG_NLS_FRAMEWORK],[ + AC_ARG_ENABLE([nls], + AS_HELP_STRING( + [--disable-nls], + [Disable support for translated messages] + ), , enable_nls=yes) + +if test "x$enable_nls" = "xyes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Set to 1 if support for translated messages should be compiled in]) +fi +]) + +dnl @synopsis PG_ICONV +dnl +dnl @summary checks for iconv() at various places and in different variants +dnl +dnl This macro sets $ac_cv_func_iconv_exists to "yes" if it can find iconv() +dnl and also sets LIBS (at least it should) and provides HAVE_ICONV to config.h +dnl +dnl Furthermore it checks if the compiler and library want you to provide a +dnl const char* and sets ICONV_CONST based on that. +dnl +dnl @category InstalledPackages +dnl @author Patrick Georgi +dnl @version 2007-03-10 +dnl @license MIT + +AC_DEFUN([PG_ICONV], +[ +if test "x$enable_nls" = "xyes"; then + AC_CACHE_VAL( + ac_cv_func_iconv_exists, + [AC_SEARCH_LIBS(iconv, [iconv intl], + ac_cv_func_iconv_exists=yes, + ac_cv_func_iconv_exists=no + )] + )dnl + if test "x$ac_cv_func_iconv_exists" = "xyes"; then + AC_DEFINE(HAVE_ICONV, 1, [Defines if iconv() is available]) + AC_CACHE_CHECK([if iconv() needs const argument], + ac_cv_func_iconv_const, + [AC_TRY_COMPILE( +[#include ], +[char* test; iconv(0,&test,0,0,0);], +ac_cv_func_iconv_const=no, + [AC_TRY_COMPILE( +[#include ], +[const char* test; iconv(0,&test,0,0,0);], +ac_cv_func_iconv_const=yes + )] + ) + ]) + if test "x$ac_cv_func_iconv_const" = "xyes"; then + AC_DEFINE(ICONV_CONST, const, [ Defines if iconv needs const argument ]) + fi + fi +fi +]) + +dnl @synopsis PG_GETTEXT +dnl +dnl @summary looks for various gettext() related functions +dnl +dnl +dnl @category InstalledPackages +dnl @author Patrick Georgi +dnl @version 2007-03-10 +dnl @license MIT + +AC_DEFUN([PG_GETTEXT], +[ +if test "x$enable_nls" = "xyes"; then + AC_CACHE_VAL( + ac_cv_func_gettext_exists, + [AC_SEARCH_LIBS(gettext, [gettext iconv intl], + ac_cv_func_gettext_exists=yes, + ac_cv_func_gettext_exists=no + )] + )dnl + if test "x$ac_cv_func_gettext_exists" = "xyes"; then + AC_DEFINE(HAVE_GETTEXT, 1, [Defines if gettext() is available]) + fi + AC_CACHE_VAL( + ac_cv_func_dcgettext_exists, + [AC_SEARCH_LIBS(dcgettext, [gettext iconv intl], + ac_cv_func_dcgettext_exists=yes, + ac_cv_func_dcgettext_exists=no + )] + )dnl + if test "x$ac_cv_func_dcgettext_exists" = "xyes"; then + AC_DEFINE(HAVE_DCGETTEXT, 1, [Defines if dcgettext() is available]) + fi +fi +]) ============================================================ --- configure.ac a25c3ddbcfadba2cad2219c840f3e8b30d12e8e4 +++ configure.ac bf94d1c9529642c33f3a46bb8636a2a02bed6b5e @@ -54,10 +54,6 @@ AX_CREATE_STDINT_H(mt-stdint.h) [AC_INCLUDES_DEFAULT()]) AC_HEADER_STDBOOL AX_CREATE_STDINT_H(mt-stdint.h) -# gettext is nominally a library, but its tests don't work in C++ mode. -AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION(0.11.5) -AM_ICONV AC_PROG_XGETTEXT_FLAG_OPTION # similarly, this calls ACX_PTHREAD, which expects C. BOOST_THREAD_STUBS @@ -86,6 +82,9 @@ AC_LANG([C++]) ]) AC_LANG([C++]) +PG_NLS_FRAMEWORK +PG_ICONV +PG_GETTEXT # This header may not be visible to the C compiler. AC_CHECK_HEADERS([cxxabi.h],,, [AC_INCLUDES_DEFAULT()])