| From 43a9b7e0d72ee97dcdbc102254ada20278eac80b Mon Sep 17 00:00:00 2001 |
| From: Christopher Degawa <ccom@randomderp.com> |
| Date: Wed, 23 Sep 2020 16:31:17 +0000 |
| Subject: [PATCH] macros/neon.m4: add prologue to NE_SEARCH_LIBS |
| |
| This check kept on failing with 32-bit windows gcc and clang |
| |
| This does remove the on-by-default `__stdcall` for ws2_32, but instead |
| uses the proper <winsock2.h> header |
| |
| Signed-off-by: Christopher Degawa <ccom@randomderp.com> |
| --- |
| macros/neon.m4 | 19 +++++++++++++++---- |
| 1 file changed, 15 insertions(+), 4 deletions(-) |
| |
| diff --git a/macros/neon.m4 b/macros/neon.m4 |
| index ccdc4a6..9a2deaa 100644 |
| --- a/macros/neon.m4 |
| +++ b/macros/neon.m4 |
| @@ -371,16 +371,27 @@ ne_cv_libsfor_$1="not found" |
| for lib in $2; do |
| # The w32api libraries link using the stdcall calling convention. |
| case ${lib}-${ne_cv_os_uname} in |
| - ws2_32-MINGW*) ne__code="__stdcall $1();" ;; |
| - *) ne__code="$1();" ;; |
| + ws2_32-MINGW*) |
| + ne__prologue="#include <winsock2.h>" |
| + case $1 in |
| + socket) ne__code="socket(0,0,0);" ;; |
| + gethostbyname) ne__code="gethostbyname(\"\")" ;; |
| + *) ne__code="$1();" ;; |
| + esac |
| + ;; |
| + *) |
| + ne__prologue="" |
| + ne__code="$1();" |
| + ;; |
| esac |
| |
| + |
| LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" |
| - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$ne__code])], |
| + AC_LINK_IFELSE([AC_LANG_PROGRAM([$ne__prologue], [$ne__code])], |
| [ne_cv_libsfor_$1="-l$lib"; break]) |
| m4_if($3, [], [], dnl If $3 is specified, then... |
| [LIBS="$ne_sl_save_LIBS -l$lib $3 $NEON_LIBS" |
| - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$ne__code])], |
| + AC_LINK_IFELSE([AC_LANG_PROGRAM([$ne__prologue], [$ne__code])], |
| [ne_cv_libsfor_$1="-l$lib $3"; break])]) |
| done |
| LIBS=$ne_sl_save_LIBS])]) |