diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2023-05-14 18:51:22 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-05-14 19:28:09 -0700 |
commit | 8c0671b9cbf56bec99a7de63ead33076abb754b1 (patch) | |
tree | ec2704f2e09e6a4d0b907a9498c03510801ace63 | |
parent | b77d357ea356134fbc159797b34498b7a0006dc9 (diff) | |
download | emacs-8c0671b9cbf56bec99a7de63ead33076abb754b1.tar.gz |
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.
-rwxr-xr-x | admin/merge-gnulib | 2 | ||||
-rw-r--r-- | configure.ac | 38 |
2 files changed, 17 insertions, 23 deletions
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 <langinfo.h>]], - [[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 <langinfo.h> 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 <langinfo.h>]], - [[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 <langinfo.h> 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 <langinfo.h>]], + [[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 <langinfo.h> + and nl_langinfo (_NL_PAPER_WIDTH).])])])]) +EMACS_PAPER_WIDTH AC_TYPE_MBSTATE_T |