Skip to content

Commit

Permalink
revert m4 macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
htrb committed Aug 16, 2024
1 parent d851cd7 commit bcc5cfc
Show file tree
Hide file tree
Showing 9 changed files with 351 additions and 261 deletions.
101 changes: 41 additions & 60 deletions m4/gettext.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# gettext.m4 serial 78 (gettext-0.22.4)
dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc.
# gettext.m4 serial 71 (gettext-0.20.2)
dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
Expand All @@ -20,13 +20,11 @@ dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
dnl Macro to add for using GNU gettext.

dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
dnl INTLSYMBOL must be one of 'external', 'use-libtool', 'here'.
dnl INTLSYMBOL should be 'external' for packages other than GNU gettext.
dnl It should be 'use-libtool' for the packages 'gettext-runtime' and
dnl 'gettext-tools'.
dnl It should be 'here' for the package 'gettext-runtime/intl'.
dnl If INTLSYMBOL is 'here', then a libtool library
dnl $(top_builddir)/libintl.la will be created (shared and/or static,
dnl INTLSYMBOL must be one of 'external', 'use-libtool'.
dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and
dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
dnl If INTLSYMBOL is 'use-libtool', then a libtool library
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
dnl depending on --{enable,disable}-{shared,static} and on the presence of
dnl AM-DISABLE-SHARED).
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
Expand Down Expand Up @@ -57,21 +55,24 @@ dnl
AC_DEFUN([AM_GNU_GETTEXT],
[
dnl Argument checking.
m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], , [m4_if([$1], [here], ,
ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
[errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
])])])])])
m4_if(m4_if([$1], [], [old])[]m4_if([$1], [no-libtool], [old]), [old],
])])])])
ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
[errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
])])
m4_if([$2], [], , [m4_if([$2], [need-ngettext], , [m4_if([$2], [need-formatstring-macros], ,
ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
[errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
])])])])
define([gt_building_libintl_in_same_build_tree],
m4_if([$1], [use-libtool], [yes], [m4_if([$1], [here], [yes], [no])]))
define([gt_included_intl],
ifelse([$1], [external], [no], [yes]))
gt_NEEDS_INIT
AM_GNU_GETTEXT_NEED([$2])
AC_REQUIRE([AM_PO_SUBDIRS])dnl
ifelse(gt_included_intl, yes, [
AC_REQUIRE([AM_INTL_SUBDIR])dnl
])
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
Expand All @@ -81,13 +82,13 @@ AC_DEFUN([AM_GNU_GETTEXT],
dnl Ideally we would do this search only after the
dnl if test "$USE_NLS" = "yes"; then
dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
dnl tests. But if configure.ac invokes AM_ICONV after AM_GNU_GETTEXT
dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
dnl the configure script would need to contain the same shell code
dnl again, outside any 'if'. There are two solutions:
dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
m4_if(gt_building_libintl_in_same_build_tree, yes, , [
ifelse(gt_included_intl, yes, , [
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
])
Expand All @@ -97,7 +98,8 @@ AC_DEFUN([AM_GNU_GETTEXT],
dnl Set USE_NLS.
AC_REQUIRE([AM_NLS])
m4_if(gt_building_libintl_in_same_build_tree, yes, [
ifelse(gt_included_intl, yes, [
BUILD_INCLUDED_LIBINTL=no
USE_INCLUDED_LIBINTL=no
])
LIBINTL=
Expand All @@ -116,7 +118,7 @@ AC_DEFUN([AM_GNU_GETTEXT],
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
gt_use_preinstalled_gnugettext=no
m4_if(gt_building_libintl_in_same_build_tree, yes, [
ifelse(gt_included_intl, yes, [
AC_MSG_CHECKING([whether included gettext is requested])
AC_ARG_WITH([included-gettext],
[ --with-included-gettext use the GNU gettext library included here],
Expand Down Expand Up @@ -172,7 +174,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
dnl Sometimes libintl requires libiconv, so first search for libiconv.
m4_if(gt_building_libintl_in_same_build_tree, yes, , [
ifelse(gt_included_intl, yes, , [
AM_ICONV_LINK
])
dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
Expand Down Expand Up @@ -210,16 +212,9 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
]])],
[eval "$gt_func_gnugettext_libintl=yes"],
[eval "$gt_func_gnugettext_libintl=no"])
dnl Now see whether libintl exists and depends on libiconv or other
dnl OS dependent libraries, specifically on macOS and AIX.
gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS"
AC_REQUIRE([AC_CANONICAL_HOST])
case "$host_os" in
aix*) gt_LIBINTL_EXTRA="-lpthread" ;;
esac
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \
&& { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then
LIBS="$LIBS $LIBICONV $gt_LIBINTL_EXTRA"
dnl Now see whether libintl exists and depends on libiconv.
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
LIBS="$LIBS $LIBICONV"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
Expand All @@ -241,8 +236,8 @@ $gt_revision_test_code
bindtextdomain ("", "");
return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
]])],
[LIBINTL="$LIBINTL $LIBICONV $gt_LIBINTL_EXTRA"
LTLIBINTL="$LTLIBINTL $LTLIBICONV $gt_LIBINTL_EXTRA"
[LIBINTL="$LIBINTL $LIBICONV"
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
eval "$gt_func_gnugettext_libintl=yes"
])
fi
Expand All @@ -257,8 +252,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
|| { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
&& test "$PACKAGE" != gettext-runtime \
&& test "$PACKAGE" != gettext-tools \
&& test "$PACKAGE" != libintl; }; then
&& test "$PACKAGE" != gettext-tools; }; then
gt_use_preinstalled_gnugettext=yes
else
dnl Reset the values set by searching for libintl.
Expand All @@ -267,7 +261,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
INCINTL=
fi
m4_if(gt_building_libintl_in_same_build_tree, yes, [
ifelse(gt_included_intl, yes, [
if test "$gt_use_preinstalled_gnugettext" != "yes"; then
dnl GNU gettext is not found in the C library.
dnl Fall back on included GNU gettext library.
Expand All @@ -277,9 +271,10 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
if test "$nls_cv_use_gnu_gettext" = "yes"; then
dnl Mark actions used to generate GNU NLS library.
BUILD_INCLUDED_LIBINTL=yes
USE_INCLUDED_LIBINTL=yes
LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
LTLIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
fi
Expand Down Expand Up @@ -346,39 +341,25 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
POSUB=po
fi
m4_if(gt_building_libintl_in_same_build_tree, yes, [
ifelse(gt_included_intl, yes, [
dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
dnl because some of the testsuite requires it.
BUILD_INCLUDED_LIBINTL=yes
dnl Make all variables we use known to autoconf.
AC_SUBST([BUILD_INCLUDED_LIBINTL])
AC_SUBST([USE_INCLUDED_LIBINTL])
AC_SUBST([CATOBJEXT])
])
m4_if(gt_building_libintl_in_same_build_tree, yes, [], [
dnl For backward compatibility. Some Makefiles may be using this.
INTLLIBS="$LIBINTL"
AC_SUBST([INTLLIBS])
])
dnl For backward compatibility. Some Makefiles may be using this.
INTLLIBS="$LIBINTL"
AC_SUBST([INTLLIBS])
dnl Make all documented variables known to autoconf.
AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL])
AC_SUBST([POSUB])
dnl Define localedir_c and localedir_c_make.
dnl Find the final value of localedir.
gt_save_prefix="${prefix}"
gt_save_datarootdir="${datarootdir}"
gt_save_localedir="${localedir}"
dnl Unfortunately, prefix gets only finally determined at the end of
dnl configure.
if test "X$prefix" = "XNONE"; then
prefix="$ac_default_prefix"
fi
eval datarootdir="$datarootdir"
eval localedir="$localedir"
gl_BUILD_TO_HOST([localedir])
localedir="${gt_save_localedir}"
datarootdir="${gt_save_datarootdir}"
prefix="${gt_save_prefix}"
])


Expand Down
Loading

0 comments on commit bcc5cfc

Please sign in to comment.