1212# PARTICULAR PURPOSE.
1313
1414m4_ifndef ( [ AC_CONFIG_MACRO_DIRS] , [ m4_defun([ _AM_CONFIG_MACRO_DIRS] , [ ] )m4_defun([ AC_CONFIG_MACRO_DIRS] , [ _AM_CONFIG_MACRO_DIRS($@ )] )] )
15- # host-cpu-c-abi.m4 serial 13
16- dnl Copyright (C) 2002-2020 Free Software Foundation, Inc.
15+ # host-cpu-c-abi.m4 serial 15
16+ dnl Copyright (C) 2002-2022 Free Software Foundation, Inc.
1717dnl This file is free software; the Free Software Foundation
1818dnl gives unlimited permission to copy and/or distribute it,
1919dnl with or without modifications, as long as this notice is preserved.
@@ -225,7 +225,7 @@ changequote([,])dnl
225225 # be generating 64-bit code.
226226 AC_COMPILE_IFELSE (
227227 [ AC_LANG_SOURCE (
228- [ [ #if defined __powerpc64__ || defined _ARCH_PPC64
228+ [ [ #if defined __powerpc64__ || defined __LP64__
229229 int ok;
230230 #else
231231 error fail
396396#ifndef __ia64__
397397#undef __ia64__
398398#endif
399+ #ifndef __loongarch64__
400+ #undef __loongarch64__
401+ #endif
399402#ifndef __m68k__
400403#undef __m68k__
401404#endif
@@ -619,7 +622,7 @@ changequote([,])dnl
619622 # be generating 64-bit code.
620623 AC_COMPILE_IFELSE (
621624 [ AC_LANG_SOURCE (
622- [ [ #if defined __powerpc64__ || defined _ARCH_PPC64
625+ [ [ #if defined __powerpc64__ || defined __LP64__
623626 int ok;
624627 #else
625628 error fail
@@ -688,15 +691,21 @@ changequote([,])dnl
688691 HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
689692] )
690693
691- # iconv.m4 serial 21
692- dnl Copyright (C) 2000-2002, 2007-2014, 2016-2020 Free Software Foundation,
694+ # iconv.m4 serial 24
695+ dnl Copyright (C) 2000-2002, 2007-2014, 2016-2022 Free Software Foundation,
693696dnl Inc.
694697dnl This file is free software; the Free Software Foundation
695698dnl gives unlimited permission to copy and/or distribute it,
696699dnl with or without modifications, as long as this notice is preserved.
697700
698701dnl From Bruno Haible.
699702
703+ AC_PREREQ ( [ 2.64] )
704+
705+ dnl Note: AM_ICONV is documented in the GNU gettext manual
706+ dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>.
707+ dnl Don't make changes that are incompatible with that documentation!
708+
700709AC_DEFUN ( [ AM_ICONV_LINKFLAGS_BODY] ,
701710[
702711 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
@@ -776,8 +785,9 @@ AC_DEFUN([AM_ICONV_LINK],
776785#endif
777786 ] ] ,
778787 [ [ int result = 0;
779- /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
780- returns. */
788+ /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from
789+ successful returns. This is even documented in
790+ <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */
781791 {
782792 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
783793 if (cd_utf8_to_88591 != (iconv_t)(-1))
@@ -915,70 +925,58 @@ AC_DEFUN([AM_ICONV_LINK],
915925 AC_SUBST ( [ LTLIBICONV] )
916926] )
917927
918- dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
919- dnl avoid warnings like
928+ dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like
920929dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
921930dnl This is tricky because of the way 'aclocal' is implemented:
922931dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
923932dnl Otherwise aclocal's initial scan pass would miss the macro definition.
924933dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
925934dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
926935dnl warnings.
927- m4_define ( [ gl_iconv_AC_DEFUN] ,
928- m4_version_prereq ( [ 2.64] ,
929- [ [ AC_DEFUN_ONCE (
930- [ $1 ] , [ $2 ] ) ] ] ,
931- [ m4_ifdef ( [ gl_00GNULIB] ,
932- [ [ AC_DEFUN_ONCE (
933- [ $1 ] , [ $2 ] ) ] ] ,
934- [ [ AC_DEFUN (
935- [ $1 ] , [ $2 ] ) ] ] ) ] ) )
936- gl_iconv_AC_DEFUN([ AM_ICONV] ,
936+ AC_DEFUN_ONCE ( [ AM_ICONV] ,
937937[
938938 AM_ICONV_LINK
939939 if test "$am_cv_func_iconv" = yes; then
940- AC_MSG_CHECKING ( [ for iconv declaration ] )
941- AC_CACHE_VAL ( [ am_cv_proto_iconv ] , [
942- AC_COMPILE_IFELSE (
943- [ AC_LANG_PROGRAM (
944- [ [
940+ AC_CACHE_CHECK ( [ whether iconv is compatible with its POSIX signature ] ,
941+ [ gl_cv_iconv_nonconst ] ,
942+ [ AC_COMPILE_IFELSE (
943+ [ AC_LANG_PROGRAM (
944+ [ [
945945#include <stdlib.h>
946946#include <iconv.h>
947947extern
948948#ifdef __cplusplus
949949"C"
950950#endif
951- #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
952951size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
953- #else
954- size_t iconv();
955- #endif
956- ] ] ,
957- [ [ ] ] ) ] ,
958- [ am_cv_proto_iconv_arg1=""] ,
959- [ am_cv_proto_iconv_arg1="const"] )
960- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"] )
961- am_cv_proto_iconv=`echo "[ $] am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
962- AC_MSG_RESULT ( [
963- $am_cv_proto_iconv] )
952+ ] ] ,
953+ [ [ ] ] ) ] ,
954+ [ gl_cv_iconv_nonconst=yes] ,
955+ [ gl_cv_iconv_nonconst=no] )
956+ ] )
964957 else
965958 dnl When compiling GNU libiconv on a system that does not have iconv yet,
966959 dnl pick the POSIX compliant declaration without 'const'.
967- am_cv_proto_iconv_arg1=""
960+ gl_cv_iconv_nonconst=yes
961+ fi
962+ if test $gl_cv_iconv_nonconst = yes; then
963+ iconv_arg1=""
964+ else
965+ iconv_arg1="const"
968966 fi
969- AC_DEFINE_UNQUOTED ( [ ICONV_CONST] , [ $am_cv_proto_iconv_arg1 ] ,
967+ AC_DEFINE_UNQUOTED ( [ ICONV_CONST] , [ $iconv_arg1 ] ,
970968 [ Define as const if the declaration of iconv() needs const.] )
971969 dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
972970 m4_ifdef ( [ gl_ICONV_H_DEFAULTS] ,
973971 [ AC_REQUIRE ( [ gl_ICONV_H_DEFAULTS] )
974- if test -n "$am_cv_proto_iconv_arg1" ; then
972+ if test $gl_cv_iconv_nonconst != yes ; then
975973 ICONV_CONST="const"
976974 fi
977975 ] )
978976] )
979977
980- # lib-ld.m4 serial 9
981- dnl Copyright (C) 1996-2003, 2009-2020 Free Software Foundation, Inc.
978+ # lib-ld.m4 serial 10
979+ dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc.
982980dnl This file is free software; the Free Software Foundation
983981dnl gives unlimited permission to copy and/or distribute it,
984982dnl with or without modifications, as long as this notice is preserved.
@@ -1101,7 +1099,7 @@ else
11011099 *-*-aix*)
11021100 AC_COMPILE_IFELSE (
11031101 [ AC_LANG_SOURCE (
1104- [ [ #if defined __powerpc64__ || defined _ARCH_PPC64
1102+ [ [ #if defined __powerpc64__ || defined __LP64__
11051103 int ok;
11061104 #else
11071105 error fail
11461144AC_LIB_PROG_LD_GNU
11471145] )
11481146
1149- # lib-link.m4 serial 31
1150- dnl Copyright (C) 2001-2020 Free Software Foundation, Inc.
1147+ # lib-link.m4 serial 33
1148+ dnl Copyright (C) 2001-2022 Free Software Foundation, Inc.
11511149dnl This file is free software; the Free Software Foundation
11521150dnl gives unlimited permission to copy and/or distribute it,
11531151dnl with or without modifications, as long as this notice is preserved.
@@ -1344,8 +1342,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
13441342 eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
13451343 ] )
13461344 AC_ARG_WITH ( PACK [ -prefix] ,
1347- [ [ --with-] ] PACK [ [ -prefix[ =DIR] search for ] PACKLIBS[ in DIR/include and DIR/lib
1348- --without-] ] PACK [ [ -prefix don't search for ] PACKLIBS[ in includedir and libdir] ] ,
1345+ [ [ --with-] ] PACK [ [ -prefix[ =DIR] search for ] ] PACKLIBS [ [ in DIR/include and DIR/lib
1346+ --without-] ] PACK [ [ -prefix don't search for ] ] PACKLIBS [ [ in includedir and libdir] ] ,
13491347[
13501348 if test "X$withval" = "Xno"; then
13511349 use_additional=no
@@ -1779,7 +1777,20 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
17791777 ;;
17801778 -l*)
17811779 dnl Handle this in the next round.
1782- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1780+ dnl But on GNU systems, ignore -lc options, because
1781+ dnl - linking with libc is the default anyway,
1782+ dnl - linking with libc.a may produce an error
1783+ dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie"
1784+ dnl or may produce an executable that always crashes, see
1785+ dnl <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>.
1786+ dep=`echo "X$dep" | sed -e 's/^X-l//'`
1787+ if test "X$dep" != Xc \
1788+ || case $host_os in
1789+ linux* | gnu* | k*bsd*-gnu) false ;;
1790+ *) true ;;
1791+ esac; then
1792+ names_next_round="$names_next_round $dep"
1793+ fi
17831794 ;;
17841795 *.la)
17851796 dnl Handle this in the next round. Throw away the .la's
@@ -1947,8 +1958,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
19471958 AC_SUBST ( [ $1 ] )
19481959] )
19491960
1950- # lib-prefix.m4 serial 17
1951- dnl Copyright (C) 2001-2005, 2008-2020 Free Software Foundation, Inc.
1961+ # lib-prefix.m4 serial 20
1962+ dnl Copyright (C) 2001-2005, 2008-2022 Free Software Foundation, Inc.
19521963dnl This file is free software; the Free Software Foundation
19531964dnl gives unlimited permission to copy and/or distribute it,
19541965dnl with or without modifications, as long as this notice is preserved.
@@ -2123,14 +2134,14 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
21232134
21242135 AC_CACHE_CHECK ( [ for ELF binary format] , [ gl_cv_elf] ,
21252136 [ AC_EGREP_CPP ( [ Extensible Linking Format] ,
2126- [ #ifdef __ELF__
2137+ [ #if defined __ELF__ || (defined __linux__ && defined __EDG__)
21272138 Extensible Linking Format
21282139 #endif
21292140 ] ,
21302141 [ gl_cv_elf=yes] ,
21312142 [ gl_cv_elf=no] )
2132- ] )
2133- if test $gl_cv_elf; then
2143+ ] )
2144+ if test $gl_cv_elf = yes ; then
21342145 # Extract the ELF class of a file (5th byte) in decimal.
21352146 # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
21362147 if od -A x < /dev/null >/dev/null 2>/dev/null; then
@@ -2147,20 +2158,23 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
21472158 echo
21482159 }
21492160 fi
2161+ # Use 'expr', not 'test', to compare the values of func_elfclass, because on
2162+ # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002,
2163+ # not 1 or 2.
21502164changequote ( ,) dnl
21512165 case $HOST_CPU_C_ABI_32BIT in
21522166 yes)
21532167 # 32-bit ABI.
21542168 acl_is_expected_elfclass ()
21552169 {
2156- test "`func_elfclass | sed -e 's/[ ] //g'`" = 1
2170+ expr "`func_elfclass | sed -e 's/[ ] //g'`" = 1 > /dev/null
21572171 }
21582172 ;;
21592173 no)
21602174 # 64-bit ABI.
21612175 acl_is_expected_elfclass ()
21622176 {
2163- test "`func_elfclass | sed -e 's/[ ] //g'`" = 2
2177+ expr "`func_elfclass | sed -e 's/[ ] //g'`" = 2 > /dev/null
21642178 }
21652179 ;;
21662180 *)
0 commit comments