]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
1b30d9926cb5bfee858b9bd5b099d7c7c014d8bc
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From 232cab527897bcdf4d55492d41af73d31905bda5 Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@cs.ucla.edu>
3 Date: Fri, 31 Mar 2023 10:46:20 -0700
4 Subject: [PATCH 04/29] Cater to programs misusing AC_EGREP_HEADER
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Problem reported by Frederic Berat in:
10 https://lists.gnu.org/archive/html/autoconf/2022-11/msg00127.html
11 * lib/autoconf/programs.m4 (AC_PROG_EGREP): Also set
12 EGREP_TRADITIONAL and ac_cv_path_EGREP_TRADITIONAL.
13 * tests/c.at (AC_PROG_EGREP and AC_EGREP_HEADER):
14 New test, taken from Frederic Berat’s email in:
15 https://lists.gnu.org/r/autoconf/2023-03/msg00043.html
16
17 Upstream-Status: Backport
18 Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 ---
20 lib/autoconf/programs.m4 | 10 ++++++++++
21 tests/c.at | 24 ++++++++++++++++++++++++
22 2 files changed, 34 insertions(+)
23
24 diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
25 index 1b7460c85..62ba6b8b6 100644
26 --- a/lib/autoconf/programs.m4
27 +++ b/lib/autoconf/programs.m4
28 @@ -371,6 +371,16 @@ AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP,
29 fi])
30 EGREP="$ac_cv_path_EGREP"
31 AC_SUBST([EGREP])
32 + dnl
33 + dnl Also set EGREP_TRADITIONAL even though unnecessary here,
34 + dnl for wrong but too-common code with the following pattern:
35 + dnl AC_PROG_EGREP
36 + dnl if false; then
37 + dnl AC_EGREP_HEADER([printf], [stdio.h], [has_printf=yes])
38 + dnl fi
39 + dnl AC_EGREP_HEADER([malloc], [stdlib.h], [has_malloc=yes])
40 + EGREP_TRADITIONAL=$EGREP
41 + ac_cv_path_EGREP_TRADITIONAL=$EGREP
42 ])# AC_PROG_EGREP
43
44 # _AC_PROG_EGREP_TRADITIONAL
45 diff --git a/tests/c.at b/tests/c.at
46 index c37f43b10..fad54760f 100644
47 --- a/tests/c.at
48 +++ b/tests/c.at
49 @@ -232,6 +232,30 @@ AT_CHECK_DEFINES(
50 AT_CLEANUP
51
52
53 +## ----------------------------------- ##
54 +## AC_PROG_EGREP and AC_EGREP_HEADER. ##
55 +## ----------------------------------- ##
56 +
57 +AT_SETUP([AC_PROG_EGREP and AC_EGREP_HEADER])
58 +
59 +_AT_CHECK_AC_MACRO(
60 +[[AC_PROG_CPP
61 + AC_PROG_EGREP
62 +
63 + # Although this code is incorrect (it should use AS_IF),
64 + # it follows a too-common real world pattern.
65 + # For now, test for it; we may remove this test later.
66 + if false; then
67 + AC_EGREP_HEADER([^], [limits.h])
68 + fi
69 +
70 + AC_EGREP_HEADER([$], [limits.h], [],
71 + [AC_MSG_ERROR([[egrep-related macros do not tolerate misuse of 'if']])])
72 +]])
73 +
74 +AT_CLEANUP
75 +
76 +
77 ## ------------------------------------ ##
78 ## AC_NO_EXECUTABLES (working linker). ##
79 ## ------------------------------------ ##
80 --
81 2.41.0
82