[PATCH GnuPG] build: Fix GNUPG_CHECK_ENDIAN to work with gcc 14

Alan Coopersmith via Gnupg-devel <[email protected]>
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <[email protected]>
Before this fix, running configure on Solaris 11.4 x86 with gcc 14
claimed x86 systems were big endian, because the test failed to compile:

conftest.c:103:1: error: return type defaults to 'int' [-Wimplicit-int]
  103 | main () {
      | ^~~~
conftest.c: In function 'main':
conftest.c:111:15: error: implicit declaration of function 'exit'
 [-Wimplicit-function-declaration]
  111 |               exit (u.c[sizeof (long) - 1] == 1);
      |               ^~~~

Signed-off-by: Alan Coopersmith <[email protected]>
---
 acinclude.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 98a87f673..a63edbe28 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -84,7 +84,7 @@ AC_DEFUN([GNUPG_CHECK_ENDIAN],
          not big endian
         #endif]])], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)])
         if test "$gnupg_cv_c_endian" = unknown; then
-            AC_RUN_IFELSE([AC_LANG_SOURCE([[main () {
+            AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],[[
               /* Are we little or big endian?  From Harbison&Steele.  */
               union
               {
@@ -93,7 +93,7 @@ AC_DEFUN([GNUPG_CHECK_ENDIAN],
               } u;
               u.l = 1;
               exit (u.c[sizeof (long) - 1] == 1);
-              }]])],
+              ]])],
               gnupg_cv_c_endian=little,
               gnupg_cv_c_endian=big,
               gnupg_cv_c_endian=$tmp_assumed_endian
-- 
2.45.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.