Skip to content

Commit c550bc1

Browse files
committed
- Fix to link with libssp for libcrypto and getaddrinfo check for
only header. Also update crosscompile to remove ssp for 32bit.
1 parent c8554ff commit c550bc1

File tree

5 files changed

+188
-39
lines changed

5 files changed

+188
-39
lines changed

acx_nlnetlabs.m4

+47-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
33
# BSD licensed.
44
#
5-
# Version 47
5+
# Version 48
6+
# 2024-01-16 fix to add -l:libssp.a to -lcrypto link check.
7+
# and check for getaddrinfo with only header.
68
# 2024-01-15 fix to add crypt32 to -lcrypto link check when checking for gdi32.
79
# 2023-05-04 fix to remove unused whitespace.
810
# 2023-01-26 fix -Wstrict-prototypes.
@@ -754,9 +756,9 @@ AC_DEFUN([ACX_SSL_CHECKS], [
754756
LIBS="$BAKLIBS"
755757
LIBSSL_LIBS="$BAKSSLLIBS"
756758
757-
LIBS="$LIBS -ldl"
758-
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
759-
AC_MSG_CHECKING([if -lcrypto needs -ldl])
759+
LIBS="$LIBS -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a"
760+
LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a"
761+
AC_MSG_CHECKING([if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a])
760762
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
761763
int EVP_sha256(void);
762764
(void)EVP_sha256();
@@ -768,9 +770,10 @@ AC_DEFUN([ACX_SSL_CHECKS], [
768770
AC_MSG_RESULT(no)
769771
LIBS="$BAKLIBS"
770772
LIBSSL_LIBS="$BAKSSLLIBS"
771-
LIBS="$LIBS -ldl -pthread"
772-
LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
773-
AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread])
773+
774+
LIBS="$LIBS -ldl"
775+
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
776+
AC_MSG_CHECKING([if -lcrypto needs -ldl])
774777
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
775778
int EVP_sha256(void);
776779
(void)EVP_sha256();
@@ -780,10 +783,25 @@ AC_DEFUN([ACX_SSL_CHECKS], [
780783
AC_MSG_RESULT(yes)
781784
],[
782785
AC_MSG_RESULT(no)
783-
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
786+
LIBS="$BAKLIBS"
787+
LIBSSL_LIBS="$BAKSSLLIBS"
788+
LIBS="$LIBS -ldl -pthread"
789+
LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
790+
AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread])
791+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
792+
int EVP_sha256(void);
793+
(void)EVP_sha256();
794+
]])],[
795+
AC_DEFINE([HAVE_EVP_SHA256], 1,
796+
[If you have EVP_sha256])
797+
AC_MSG_RESULT(yes)
798+
],[
799+
AC_MSG_RESULT(no)
800+
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
801+
])
784802
])
785803
])
786-
])
804+
])
787805
])
788806
])
789807
fi
@@ -890,14 +908,32 @@ dnl see if on windows
890908
if test "$ac_cv_header_windows_h" = "yes"; then
891909
AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used])
892910
USE_WINSOCK="1"
893-
if echo $LIBS | grep 'lws2_32' >/dev/null; then
911+
if echo "$LIBS" | grep 'lws2_32' >/dev/null; then
894912
:
895913
else
896914
LIBS="$LIBS -lws2_32"
897915
fi
898916
fi
899917
],
900918
dnl no quick getaddrinfo, try mingw32 and winsock2 library.
919+
dnl perhaps getaddrinfo needs only the include
920+
AC_LINK_IFELSE(
921+
[AC_LANG_PROGRAM(
922+
[
923+
#ifdef HAVE_WS2TCPIP_H
924+
#include <ws2tcpip.h>
925+
#endif
926+
],
927+
[
928+
(void)getaddrinfo(NULL, NULL, NULL, NULL);
929+
]
930+
)],
931+
[
932+
ac_cv_func_getaddrinfo="yes"
933+
AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used])
934+
USE_WINSOCK="1"
935+
],
936+
901937
ORIGLIBS="$LIBS"
902938
LIBS="$LIBS -lws2_32"
903939
AC_LINK_IFELSE(
@@ -922,6 +958,7 @@ ac_cv_func_getaddrinfo="no"
922958
LIBS="$ORIGLIBS"
923959
])
924960
)
961+
)
925962
926963
AC_MSG_RESULT($ac_cv_func_getaddrinfo)
927964
if test $ac_cv_func_getaddrinfo = yes; then

configure

+89-13
Original file line numberDiff line numberDiff line change
@@ -18138,10 +18138,10 @@ $as_echo "no" >&6; }
1813818138
LIBS="$BAKLIBS"
1813918139
LIBSSL_LIBS="$BAKSSLLIBS"
1814018140

18141-
LIBS="$LIBS -ldl"
18142-
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
18143-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5
18144-
$as_echo_n "checking if -lcrypto needs -ldl... " >&6; }
18141+
LIBS="$LIBS -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a"
18142+
LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a"
18143+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a" >&5
18144+
$as_echo_n "checking if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32 -l:libssp.a... " >&6; }
1814518145
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1814618146
/* end confdefs.h. */
1814718147

@@ -18170,10 +18170,11 @@ else
1817018170
$as_echo "no" >&6; }
1817118171
LIBS="$BAKLIBS"
1817218172
LIBSSL_LIBS="$BAKSSLLIBS"
18173-
LIBS="$LIBS -ldl -pthread"
18174-
LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
18175-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl -pthread" >&5
18176-
$as_echo_n "checking if -lcrypto needs -ldl -pthread... " >&6; }
18173+
18174+
LIBS="$LIBS -ldl"
18175+
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
18176+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5
18177+
$as_echo_n "checking if -lcrypto needs -ldl... " >&6; }
1817718178
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1817818179
/* end confdefs.h. */
1817918180

@@ -18200,7 +18201,43 @@ else
1820018201

1820118202
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1820218203
$as_echo "no" >&6; }
18203-
as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5
18204+
LIBS="$BAKLIBS"
18205+
LIBSSL_LIBS="$BAKSSLLIBS"
18206+
LIBS="$LIBS -ldl -pthread"
18207+
LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
18208+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl -pthread" >&5
18209+
$as_echo_n "checking if -lcrypto needs -ldl -pthread... " >&6; }
18210+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18211+
/* end confdefs.h. */
18212+
18213+
int
18214+
main ()
18215+
{
18216+
18217+
int EVP_sha256(void);
18218+
(void)EVP_sha256();
18219+
18220+
;
18221+
return 0;
18222+
}
18223+
_ACEOF
18224+
if ac_fn_c_try_link "$LINENO"; then :
18225+
18226+
18227+
$as_echo "#define HAVE_EVP_SHA256 1" >>confdefs.h
18228+
18229+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
18230+
$as_echo "yes" >&6; }
18231+
18232+
else
18233+
18234+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18235+
$as_echo "no" >&6; }
18236+
as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5
18237+
18238+
fi
18239+
rm -f core conftest.err conftest.$ac_objext \
18240+
conftest$ac_exeext conftest.$ac_ext
1820418241

1820518242
fi
1820618243
rm -f core conftest.err conftest.$ac_objext \
@@ -19885,7 +19922,7 @@ if test x_$enable_static_exe = x_yes; then
1988519922
if test "$on_mingw" = yes; then
1988619923
staticexe="-all-static"
1988719924
# for static compile, include gdi32 and zlib here.
19888-
if echo $LIBS | grep 'lgdi32' >/dev/null; then
19925+
if echo "$LIBS" | grep 'lgdi32' >/dev/null; then
1988919926
:
1989019927
else
1989119928
LIBS="$LIBS -lgdi32"
@@ -19930,7 +19967,11 @@ if test "x$ac_cv_lib_z_compress" = xyes; then :
1993019967
LIBS="$LIBS -lz"
1993119968
fi
1993219969

19933-
LIBS="$LIBS -l:libssp.a"
19970+
if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then
19971+
:
19972+
else
19973+
LIBS="$LIBS -l:libssp.a"
19974+
fi
1993419975
fi
1993519976
fi
1993619977

@@ -19989,7 +20030,11 @@ if test "x$ac_cv_lib_z_compress" = xyes; then :
1998920030
LIBS="$LIBS -lz"
1999020031
fi
1999120032

19992-
LIBS="$LIBS -l:libssp.a"
20033+
if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then
20034+
:
20035+
else
20036+
LIBS="$LIBS -l:libssp.a"
20037+
fi
1999320038
fi
1999420039
fi
1999520040

@@ -20036,13 +20081,40 @@ if test "$ac_cv_header_windows_h" = "yes"; then
2003620081
$as_echo "#define USE_WINSOCK 1" >>confdefs.h
2003720082

2003820083
USE_WINSOCK="1"
20039-
if echo $LIBS | grep 'lws2_32' >/dev/null; then
20084+
if echo "$LIBS" | grep 'lws2_32' >/dev/null; then
2004020085
:
2004120086
else
2004220087
LIBS="$LIBS -lws2_32"
2004320088
fi
2004420089
fi
2004520090

20091+
else
20092+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
20093+
/* end confdefs.h. */
20094+
20095+
#ifdef HAVE_WS2TCPIP_H
20096+
#include <ws2tcpip.h>
20097+
#endif
20098+
20099+
int
20100+
main ()
20101+
{
20102+
20103+
(void)getaddrinfo(NULL, NULL, NULL, NULL);
20104+
20105+
20106+
;
20107+
return 0;
20108+
}
20109+
_ACEOF
20110+
if ac_fn_c_try_link "$LINENO"; then :
20111+
20112+
ac_cv_func_getaddrinfo="yes"
20113+
20114+
$as_echo "#define USE_WINSOCK 1" >>confdefs.h
20115+
20116+
USE_WINSOCK="1"
20117+
2004620118
else
2004720119
ORIGLIBS="$LIBS"
2004820120
LIBS="$LIBS -lws2_32"
@@ -20085,6 +20157,10 @@ fi
2008520157
rm -f core conftest.err conftest.$ac_objext \
2008620158
conftest$ac_exeext conftest.$ac_ext
2008720159

20160+
fi
20161+
rm -f core conftest.err conftest.$ac_objext \
20162+
conftest$ac_exeext conftest.$ac_ext
20163+
2008820164
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5
2008920165
$as_echo "$ac_cv_func_getaddrinfo" >&6; }
2009020166
if test $ac_cv_func_getaddrinfo = yes; then

configure.ac

+11-3
Original file line numberDiff line numberDiff line change
@@ -1526,13 +1526,17 @@ if test x_$enable_static_exe = x_yes; then
15261526
if test "$on_mingw" = yes; then
15271527
staticexe="-all-static"
15281528
# for static compile, include gdi32 and zlib here.
1529-
if echo $LIBS | grep 'lgdi32' >/dev/null; then
1529+
if echo "$LIBS" | grep 'lgdi32' >/dev/null; then
15301530
:
15311531
else
15321532
LIBS="$LIBS -lgdi32"
15331533
fi
15341534
AC_CHECK_LIB([z], [compress], [ LIBS="$LIBS -lz" ])
1535-
LIBS="$LIBS -l:libssp.a"
1535+
if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then
1536+
:
1537+
else
1538+
LIBS="$LIBS -l:libssp.a"
1539+
fi
15361540
fi
15371541
fi
15381542

@@ -1549,7 +1553,11 @@ if test x_$enable_fully_static = x_yes; then
15491553
LIBS="$LIBS -lgdi32"
15501554
fi
15511555
AC_CHECK_LIB([z], [compress], [ LIBS="$LIBS -lz" ])
1552-
LIBS="$LIBS -l:libssp.a"
1556+
if echo "$LIBS" | grep -e "libssp.a" -e "lssp" >/dev/null; then
1557+
:
1558+
else
1559+
LIBS="$LIBS -l:libssp.a"
1560+
fi
15531561
fi
15541562
fi
15551563

doc/Changelog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
16 January 2024: Wouter
2+
- Fix to link with libssp for libcrypto and getaddrinfo check for
3+
only header. Also update crosscompile to remove ssp for 32bit.
4+
15
15 January 2024: Wouter
26
- Fix to link with -lcrypt32 for OpenSSL 3.2.0 on Windows.
37

0 commit comments

Comments
 (0)