summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-11-05 20:04:11 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2017-11-05 20:04:57 -0800
commit4b0ea422d8a400375f957c0dee6faaf92802c625 (patch)
tree6286271b2b90c297e266d92161a61f20b9d76ac8 /m4
parent1d74e2dc33cdac166bd8f59b3b59e7ec885d1f83 (diff)
downloadgnulib-4b0ea422d8a400375f957c0dee6faaf92802c625.tar.gz
Don’t use AC_EGREP_CPP if affected by CFLAGS
* m4/float_h.m4 (gl_FLOAT_H): * m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): * m4/lib-ld.m4 (AC_LIB_PROG_LD): * m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): * m4/year2038.m4 (gl_YEAR2038): Prefer AC_COMPILE_IFELSE to AC_EGREP_CPP when testing conditions likely to be affected by the choice of CFLAGS, since CFLAGS are not used by AC_EGREP_CPP. Without this patch, ‘./configure CFLAGS="-m32"’ fails on gzip with GNU/Linux x86-64.
Diffstat (limited to 'm4')
-rw-r--r--m4/float_h.m426
-rw-r--r--m4/host-cpu-c-abi.m4147
-rw-r--r--m4/lib-ld.m427
-rw-r--r--m4/lib-prefix.m417
-rw-r--r--m4/year2038.m415
5 files changed, 152 insertions, 80 deletions
diff --git a/m4/float_h.m4 b/m4/float_h.m4
index 4c42176b6f..24bd06ecc1 100644
--- a/m4/float_h.m4
+++ b/m4/float_h.m4
@@ -1,4 +1,4 @@
-# float_h.m4 serial 11
+# float_h.m4 serial 12
dnl Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,10 +24,14 @@ changequote([,])dnl
x86_64 )
# On x86_64 systems, the C compiler may still be generating
# 32-bit code.
- AC_EGREP_CPP([yes],
- [#if defined __LP64__ || defined __x86_64__ || defined __amd64__
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[],
[FLOAT_H=float.h])
;;
@@ -69,10 +73,14 @@ int main ()
[gl_cv_func_itold_works=no],
[case "$host" in
sparc*-*-linux*)
- AC_EGREP_CPP([yes],
- [#if defined __LP64__ || defined __arch64__
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__ || defined __arch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_func_itold_works="guessing no"],
[gl_cv_func_itold_works="guessing yes"])
;;
diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index 59b0ebf67e..9370c31858 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -1,4 +1,4 @@
-# host-cpu-c-abi.m4 serial 7
+# host-cpu-c-abi.m4 serial 8
dnl Copyright (C) 2002-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -68,14 +68,23 @@ changequote([,])dnl
# with native Windows (mingw, MSVC).
# - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
# - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
- AC_EGREP_CPP([yes],
- [#if defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_AMD64
- yes
- #endif],
- [AC_EGREP_CPP([yes],
- [#if defined __ILP32__ || defined _ILP32
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if (defined __x86_64__ || defined __amd64__ \
+ || defined _M_X64 || defined _M_AMD64)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __ILP32__ || defined _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=x86_64-x32],
[gl_cv_host_cpu_c_abi=x86_64])],
[gl_cv_host_cpu_c_abi=i386])
@@ -94,14 +103,22 @@ changequote([,])dnl
# - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
# - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
# - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
- AC_EGREP_CPP([yes],
- [#if defined __aarch64__
- yes
- #endif],
- [AC_EGREP_CPP([yes],
- [#if defined __ILP32__ || defined _ILP32
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef __aarch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __ILP32__ || defined _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=arm64-ilp32],
[gl_cv_host_cpu_c_abi=arm64])],
[# Don't distinguish little-endian and big-endian arm, since they
@@ -130,10 +147,14 @@ changequote([,])dnl
hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
# On hppa, the C compiler may be generating 32-bit code or 64-bit
# code. In the latter case, it defines _LP64 and __LP64__.
- AC_EGREP_CPP([yes],
- [#if defined(__LP64__)
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef __LP64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=hppa64],
[gl_cv_host_cpu_c_abi=hppa])
;;
@@ -141,10 +162,14 @@ changequote([,])dnl
ia64* )
# On ia64 on HP-UX, the C compiler may be generating 64-bit code or
# 32-bit code. In the latter case, it defines _ILP32.
- AC_EGREP_CPP([yes],
- [#if defined _ILP32
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=ia64-ilp32],
[gl_cv_host_cpu_c_abi=ia64])
;;
@@ -152,19 +177,27 @@ changequote([,])dnl
mips* )
# We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
# at 32.
- AC_EGREP_CPP([yes],
- [#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=mips64],
[# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
# may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
# In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
# may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
- AC_EGREP_CPP([yes],
- [#if (_MIPS_SIM == _ABIN32)
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if (_MIPS_SIM == _ABIN32)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=mipsn32],
[gl_cv_host_cpu_c_abi=mips])])
;;
@@ -176,16 +209,24 @@ changequote([,])dnl
# On powerpc64 systems, the C compiler may still be generating
# 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
# be generating 64-bit code.
- AC_EGREP_CPP([yes],
- [#if defined __powerpc64__ || defined _ARCH_PPC64
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[# On powerpc64, there are two ABIs on Linux: The AIX compatible
# one and the ELFv2 one. The latter defines _CALL_ELF=2.
- AC_EGREP_CPP([yes],
- [#if defined _CALL_ELF && _CALL_ELF == 2
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined _CALL_ELF && _CALL_ELF == 2
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=powerpc64-elfv2],
[gl_cv_host_cpu_c_abi=powerpc64])
],
@@ -199,10 +240,14 @@ changequote([,])dnl
s390* )
# On s390x, the C compiler may be generating 64-bit (= s390x) code
# or 31-bit (= s390) code.
- AC_EGREP_CPP([yes],
- [#if defined(__LP64__) || defined(__s390x__)
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__ || defined __s390x__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=s390x],
[gl_cv_host_cpu_c_abi=s390])
;;
@@ -210,10 +255,14 @@ changequote([,])dnl
sparc | sparc64 )
# UltraSPARCs running Linux have `uname -m` = "sparc64", but the
# C compiler still generates 32-bit code.
- AC_EGREP_CPP([yes],
- [#if defined __sparcv9 || defined __arch64__
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __sparcv9 || defined __arch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[gl_cv_host_cpu_c_abi=sparc64],
[gl_cv_host_cpu_c_abi=sparc])
;;
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
index cffa0ef913..0f0c599fba 100644
--- a/m4/lib-ld.m4
+++ b/m4/lib-ld.m4
@@ -1,4 +1,4 @@
-# lib-ld.m4 serial 8
+# lib-ld.m4 serial 9
dnl Copyright (C) 1996-2003, 2009-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -120,11 +120,14 @@ else
fi
case $host in
*-*-aix*)
- AC_EGREP_CPP([yes],
- [#if defined __powerpc64__ || defined _ARCH_PPC64
- yes
- #endif
- ],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[# The compiler produces 64-bit code. Add option '-b64' so that the
# linker groks 64-bit object files.
case "$acl_cv_path_LD " in
@@ -134,10 +137,14 @@ else
], [])
;;
sparc64-*-netbsd*)
- AC_EGREP_CPP([yes],
- [#if defined __sparcv9 || defined __arch64__
- yes
- #endif],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __sparcv9 || defined __arch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[],
[# The compiler produces 32-bit code. Add option '-m elf32_sparc'
# so that the linker groks 32-bit object files.
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
index ea3b03a633..6699ca172f 100644
--- a/m4/lib-prefix.m4
+++ b/m4/lib-prefix.m4
@@ -1,4 +1,4 @@
-# lib-prefix.m4 serial 9
+# lib-prefix.m4 serial 10
dnl Copyright (C) 2001-2005, 2008-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -188,11 +188,16 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
dnl symlink is missing, so we set acl_libdirstem2 too.
AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
- [AC_EGREP_CPP([sixtyfour bits], [
-#ifdef _LP64
-sixtyfour bits
-#endif
- ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+ [AC_COMPILE_IFELSE([sixtyfour bits],
+ [AC_LANG_SOURCE(
+ [[#ifdef _LP64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_solaris_64bit=yes],
+ [gl_cv_solaris_64bit=no])
])
if test $gl_cv_solaris_64bit = yes; then
acl_libdirstem=lib/64
diff --git a/m4/year2038.m4 b/m4/year2038.m4
index 6e21f631dd..b9adc99bdb 100644
--- a/m4/year2038.m4
+++ b/m4/year2038.m4
@@ -1,4 +1,4 @@
-# year2038.m4 serial 1
+# year2038.m4 serial 2
dnl Copyright (C) 2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -43,11 +43,14 @@ AC_DEFUN([gl_YEAR2038],
if test $gl_cv_type_time_t_64 = no; then
dnl Just bail out if 'time_t' is not 64-bit, and let the user fix the
dnl problem.
- AC_EGREP_CPP([booboo], [
- #ifdef _USE_32BIT_TIME_T
- booboo
- #endif
- ],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef _USE_32BIT_TIME_T
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
[AC_MSG_FAILURE([This package requires a 64-bit 'time_t' type. Remove _USE_32BIT_TIME_T from the compiler flags.])],
[AC_MSG_FAILURE([This package requires a 64-bit 'time_t' type. Your system include files surely provide a way to make 'time_t' an alias of '__time64_t'.])])
fi