Skip to content

Commit ac18b8c

Browse files
committed
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 <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8591 Tested-by: jenkins
1 parent 345473f commit ac18b8c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

configure.ac

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ AC_SEARCH_LIBS([openpty], [util])
5252

5353
AC_CHECK_HEADERS([sys/socket.h])
5454
AC_CHECK_HEADERS([elf.h])
55-
AC_EGREP_HEADER(Elf64_Ehdr, [elf.h], [
56-
AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type `Elf64_Ehdr'.])
57-
])
55+
56+
AC_CHECK_TYPE([Elf64_Ehdr],
57+
AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type 'Elf64_Ehdr'.]),
58+
[], [[#include <elf.h>]])
59+
5860
AC_CHECK_HEADERS([fcntl.h])
5961
AC_CHECK_HEADERS([malloc.h])
6062
AC_CHECK_HEADERS([netdb.h])

0 commit comments

Comments
 (0)