gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 02/03: configure: used better detection of some function


From: gnunet
Subject: [libmicrohttpd] 02/03: configure: used better detection of some functions when cross-compiling
Date: Fri, 23 Dec 2022 15:49:40 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 2efc013917d69a2fc60fbb3eb44fa21801fe0580
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Dec 23 16:38:13 2022 +0300

    configure: used better detection of some functions when cross-compiling
---
 configure.ac | 79 +++++++++++++++++++++---------------------------------------
 1 file changed, 27 insertions(+), 52 deletions(-)

diff --git a/configure.ac b/configure.ac
index b032badc..eb323051 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1750,29 +1750,11 @@ AC_CHECK_MEMBERS([struct sockaddr_in.sin_len, struct 
sockaddr_in6.sin6_len,
 #endif
    ])
 
-MHD_CHECK_FUNC([getsockname],
-  [[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-  ]],
-  [
-    struct sockaddr_storage ss;
-    (void)getsockname(socket(0,0,0),(struct sockaddr *)&ss,(void*)0);
-  ],
+MHD_CHECK_LINK_RUN([[for working getsockname()]],[[mhd_cv_getsockname_usable]],
+  [[mhd_cv_getsockname_usable='assuming yes']],
   [
-    AC_CACHE_CHECK([[whether getsockname() is usable]], 
[[mhd_cv_getsockname_usable]],
-      [
-         AC_RUN_IFELSE(
-           [
-            AC_LANG_SOURCE(
-             [[
+    AC_LANG_SOURCE(
+      [[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -1853,18 +1835,10 @@ int main(void)
 #endif
   return ret;
 }
-             ]]
-            )
-           ],
-           [[mhd_cv_getsockname_usable='yes']],
-           [[mhd_cv_getsockname_usable='no']],
-           [[mhd_cv_getsockname_usable='assuming yes']]
-         )
-        ]
-      )
-    AS_VAR_IF([[mhd_cv_getsockname_usable]], [["no"]], [:],
-        [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable 
`getsockname' function.])])
-  ]
+      ]]
+    )
+  ],
+  [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable 
`getsockname' function.])]
 )
 
 AC_CACHE_CHECK([for usable PAGESIZE macro], [mhd_cv_macro_pagesize_usable],
@@ -2074,8 +2048,13 @@ AC_INCLUDES_DEFAULT
       use_itc='pipe'
       enable_itc="$use_itc"
       AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread 
communication])
-      AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [
-        AC_RUN_IFELSE([
+      MHD_CHECK_LINK_RUN([[whether pipe2(2) is 
usable]],[[mhd_cv_pipe2_usable]],
+        [
+          # Cross-compiling
+          AS_CASE([${host_os}], [kfreebsd*-gnu], 
[[mhd_cv_pipe2_usable='assuming no']],
+            [[mhd_cv_pipe2_usable='assuming yes']])
+        ],
+        [
           AC_LANG_PROGRAM([
 AC_INCLUDES_DEFAULT
 #ifdef HAVE_FCNTL_H
@@ -2084,22 +2063,18 @@ AC_INCLUDES_DEFAULT
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-          ], [[
-            int arr[2];
-            int res;
-            res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
-            if (res != 0) return 33;
-            close (arr[0]);
-            close (arr[1]);
-          ]])
-        ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']], [
-          # Cross-compiling
-          AS_CASE([${host_os}], [kfreebsd*-gnu], 
[[mhd_cv_pipe2_usable='assuming no']],
-            [[mhd_cv_pipe2_usable='assuming yes']])
-        ])
-      ])
-      AS_CASE([["X-${mhd_cv_pipe2_usable}"]], [[X*yes]],
-        [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable 
pipe2(2) function])])
+            ], [[
+              int arr[2];
+              int res;
+              res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
+              if (res != 0) return 33;
+              close (arr[0]);
+              close (arr[1]);
+            ]]
+          )
+        ],
+        [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable 
pipe2(2) function])]
+      )
     ], [
       AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not 
usable, consider using other type of inter-thread communication]])])
     ])

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]