aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2024-11-17 21:35:45 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2025-01-25 10:36:11 +0000
commitac18b8cd6a3f21b97f942efdbb0ec2f362bb132b (patch)
tree34cd6318d44013355646c204d308797a3115bb37
parent345473f3ceaf6a1241f62354e31eeababfc56588 (diff)
downloadriscv-openocd-ac18b8cd6a3f21b97f942efdbb0ec2f362bb132b.zip
riscv-openocd-ac18b8cd6a3f21b97f942efdbb0ec2f362bb132b.tar.gz
riscv-openocd-ac18b8cd6a3f21b97f942efdbb0ec2f362bb132b.tar.bz2
configure: make more robust the check for elf 64
The check if 'elf.h' defines the type 'Elf64_Ehdr' is currently done through 'grep' on the file. While there is no false positive, so far, such test could incorrectly find the text inside a comment or in a block guarded by #if/#endif. Use the autoconf macro AC_CHECK_TYPE() to detect if the type is properly declared. Change-Id: Ibb74db3d90ac6d1589b9dc1e5a7ae59e47945e78 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8591 Tested-by: jenkins
-rw-r--r--configure.ac8
1 files changed, 5 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 4905428..fc1e20e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,9 +52,11 @@ AC_SEARCH_LIBS([openpty], [util])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([elf.h])
-AC_EGREP_HEADER(Elf64_Ehdr, [elf.h], [
- AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type `Elf64_Ehdr'.])
-])
+
+AC_CHECK_TYPE([Elf64_Ehdr],
+ AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type 'Elf64_Ehdr'.]),
+ [], [[#include <elf.h>]])
+
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([netdb.h])