From: Paul Eggert Date: Mon, 15 May 2023 01:51:22 +0000 (-0700) Subject: Avoid duplicate configure-time codeset tests X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8c0671b9cbf56bec99a7de63ead33076abb754b1;p=emacs.git Avoid duplicate configure-time codeset tests * admin/merge-gnulib: Copy m4/codeset.m4 too. This is mostly for documentation, as it’s now automatically copied by other modules. * configure.ac (EMACS_PAPER_WIDTH): New macro. This relies on Gnulib, to avoid duplicate tests for HAVE_LANGINFO_CODESET. --- diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 917ddda1fd5..7c82be98608 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -132,5 +132,7 @@ cp -- "$gnulib_srcdir"/build-aux/config.guess \ cp -- "$gnulib_srcdir"/lib/af_alg.h \ "$gnulib_srcdir"/lib/save-cwd.h \ "$src"lib && +cp -- "$gnulib_srcdir"/m4/codeset.m4 \ + "$src"m4 && { test -z "$src" || cd "$src"; } && ./autogen.sh diff --git a/configure.ac b/configure.ac index dd247e144f4..8b08100464e 100644 --- a/configure.ac +++ b/configure.ac @@ -5409,29 +5409,21 @@ if test "${emacs_cv_links_glib}" = "yes"; then fi AC_SUBST([XGSELOBJ]) -dnl Adapted from Haible's version. -AC_CACHE_CHECK([for nl_langinfo and CODESET], [emacs_cv_langinfo_codeset], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[char *cs = nl_langinfo(CODESET);]])], - [emacs_cv_langinfo_codeset=yes], - [emacs_cv_langinfo_codeset=no]) - ]) -if test "$emacs_cv_langinfo_codeset" = yes; then - AC_DEFINE([HAVE_LANGINFO_CODESET], [1], - [Define if you have and nl_langinfo (CODESET).]) - - AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH], - [emacs_cv_langinfo__nl_paper_width], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])], - [emacs_cv_langinfo__nl_paper_width=yes], - [emacs_cv_langinfo__nl_paper_width=no]) - ]) - if test "$emacs_cv_langinfo__nl_paper_width" = yes; then - AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], [1], - [Define if you have and nl_langinfo (_NL_PAPER_WIDTH).]) - fi -fi +AC_DEFUN([EMACS_PAPER_WIDTH], + [AC_REQUIRE([AM_LANGINFO_CODESET]) + AS_IF([test "$am_cv_langinfo_codeset" = yes], + [AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH], + [emacs_cv_langinfo__nl_paper_width], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])], + [emacs_cv_langinfo__nl_paper_width=yes], + [emacs_cv_langinfo__nl_paper_width=no]) + ]) + AS_IF([test "$emacs_cv_langinfo__nl_paper_width" = yes], + [AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], [1], + [Define if you have + and nl_langinfo (_NL_PAPER_WIDTH).])])])]) +EMACS_PAPER_WIDTH AC_TYPE_MBSTATE_T