Lines Matching +full:libssl +full:- +full:dev
1 # acx_nlnetlabs.m4 - common macros for configure checks
6 # 2024-01-16 fix to add -l:libssp.a to -lcrypto link check.
8 # 2024-01-15 fix to add crypt32 to -lcrypto link check when checking for gdi32.
9 # 2023-05-04 fix to remove unused whitespace.
10 # 2023-01-26 fix -Wstrict-prototypes.
11 # 2022-09-01 fix checking if nonblocking sockets work on OpenBSD.
12 # 2021-08-17 fix sed script in ssldir split handling.
13 # 2021-08-17 fix for openssl to detect split version, with ssldir_include
15 # 2021-07-30 fix for openssl use of lib64 directory.
16 # 2021-06-14 fix nonblocking test to use host instead of target for mingw test.
17 # 2021-05-17 fix nonblocking socket test from grep on mingw32 to mingw for
19 # 2021-03-24 fix ACX_FUNC_DEPRECATED to use CPPFLAGS and CFLAGS.
20 # 2021-01-05 fix defun for aclocal
21 # 2021-01-05 autoconf 2.70 autoupdate and fixes, no AC_TRY_COMPILE
22 # 2020-08-24 Use EVP_sha256 instead of HMAC_Update (for openssl-3.0.0).
23 # 2016-03-21 Check -ldl -pthread for libcrypto for ldns and openssl 1.1.0.
24 # 2016-03-21 Use HMAC_Update instead of HMAC_CTX_Init (for openssl-1.1.0).
25 # 2016-01-04 -D_DEFAULT_SOURCE defined with -D_BSD_SOURCE for Linux glibc 2.20
26 # 2015-12-11 FLTO check for new OSX, clang.
27 # 2015-11-18 spelling check fix.
28 # 2015-11-05 ACX_SSL_CHECKS no longer adds -ldl needlessly.
29 # 2015-08-28 ACX_CHECK_PIE and ACX_CHECK_RELRO_NOW added.
30 # 2015-03-17 AHX_CONFIG_REALLOCARRAY added
31 # 2013-09-19 FLTO help text improved.
32 # 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes
33 # 2013-06-25 FLTO has --disable-flto option.
34 # 2013-05-03 Update W32_SLEEP for newer mingw that links but not defines it.
35 # 2013-03-22 Fix ACX_RSRC_VERSION for long version numbers.
36 # 2012-02-09 Fix AHX_MEMCMP_BROKEN with undef in compat/memcmp.h.
37 # 2012-01-20 Fix COMPILER_FLAGS_UNBOUND for gcc 4.6.2 assigned-not-used-warns.
38 # 2011-12-05 Fix getaddrinfowithincludes on windows with fedora16 mingw32-gcc.
40 # Fix GETADDRINFO_WITH_INCLUDES to add -lws2_32
41 # 2011-11-10 Fix FLTO test to not drop a.out in current directory.
42 # 2011-11-01 Fix FLTO test for llvm on Lion.
43 # 2011-08-01 Fix nonblock test (broken at v13).
44 # 2011-08-01 Fix autoconf 2.68 warnings
45 # 2011-06-23 Add ACX_CHECK_FLTO to check -flto.
46 # 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66.
47 # 2010-07-02 Add check for ss_family (for minix).
48 # 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS.
49 # 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end.
50 # 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS separate, -ldl
51 # 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN
52 # 2010-01-20 added AHX_COONFIG_STRLCAT
53 # 2009-07-14 U_CHAR detection improved for windows crosscompile.
57 # 2009-07-13 added ACX_WITH_SSL_OPTIONAL
58 # 2009-07-03 fixup LDFLAGS for empty ssl dir.
66 # ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc.
67 # ACX_RSRC_VERSION - create windows resource version number.
68 # ACX_CHECK_COMPILER_FLAG - see if cc supports a flag.
69 # ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below).
70 # ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly.
71 # ACX_DEPFLAG - find cc dependency flags.
72 # ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX.
73 # ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax.
74 # ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax.
75 # ACX_CHECK_FLTO - see if cc supports -flto and use it if so.
76 # ACX_LIBTOOL_C_ONLY - create libtool for C only, improved.
77 # ACX_TYPE_U_CHAR - u_char type.
78 # ACX_TYPE_RLIM_T - rlim_t type.
79 # ACX_TYPE_SOCKLEN_T - socklen_t type.
80 # ACX_TYPE_IN_ADDR_T - in_addr_t type.
81 # ACX_TYPE_IN_PORT_T - in_port_t type.
82 # ACX_ARG_RPATH - add --disable-rpath option.
83 # ACX_WITH_SSL - add --with-ssl option, link -lcrypto.
84 # ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto,
85 # where --without-ssl is also accepted
86 # ACX_LIB_SSL - setup to link -lssl.
87 # ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files.
88 # ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably.
89 # ACX_FUNC_DEPRECATED - see if func is deprecated.
90 # ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work.
91 # ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments.
92 # ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably.
93 # ACX_FUNC_MALLOC - check malloc, define replacement .
94 # AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format.
95 # AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused.
96 # AHX_CONFIG_FSEEKO - define fseeko, ftello fallback.
97 # AHX_CONFIG_RAND_MAX - define RAND_MAX if needed.
98 # AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed.
99 # AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed.
100 # AHX_CONFIG_SNPRINTF - snprintf compat prototype
101 # AHX_CONFIG_INET_PTON - inet_pton compat prototype
102 # AHX_CONFIG_INET_NTOP - inet_ntop compat prototype
103 # AHX_CONFIG_INET_ATON - inet_aton compat prototype
104 # AHX_CONFIG_MEMMOVE - memmove compat prototype
105 # AHX_CONFIG_STRLCAT - strlcat compat prototype
106 # AHX_CONFIG_STRLCPY - strlcpy compat prototype
107 # AHX_CONFIG_GMTIME_R - gmtime_r compat prototype
108 # AHX_CONFIG_W32_SLEEP - w32 compat for sleep
109 # AHX_CONFIG_W32_USLEEP - w32 compat for usleep
110 # AHX_CONFIG_W32_RANDOM - w32 compat for random
111 # AHX_CONFIG_W32_SRANDOM - w32 compat for srandom
112 # AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T.
113 # ACX_CFLAGS_STRIP - strip one flag from CFLAGS
114 # ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS
115 # AHX_CONFIG_FLAG_OMITTED - define omitted flag
116 # AHX_CONFIG_FLAG_EXT - define omitted extension flag
117 # AHX_CONFIG_EXT_FLAGS - define the stripped extension flags
118 # ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters.
119 # AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED.
120 # ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family
121 # ACX_CHECK_PIE - add --enable-pie option and check if works
122 # ACX_CHECK_RELRO_NOW - add --enable-relro-now option and check it
129 AC_DEFUN([ACX_ESCAPE_BACKSLASH], [$2="`echo $1 | sed -e 's/\\\\/\\\\\\\\/g'`"
132 dnl Calculate comma separated windows-resource numbers from package version.
136 …-e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*…
141 dnl $1: the flag without a - in front, so g to check -g.
147 AC_MSG_CHECKING(whether $CC supports -$1)
148 cache=`echo $1 | sed 'y%.=/+-%___p_%'`
152 if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then
157 rm -f conftest conftest.o conftest.c
174 ACX_CHECK_COMPILER_FLAG(Werror, [ERRFLAG="-Werror"], [ERRFLAG="-errwarn"])
175 ACX_CHECK_COMPILER_FLAG(Wall, [ERRFLAG="$ERRFLAG -Wall"],
176 [ERRFLAG="$ERRFLAG -errfmt"])
191 dnl cache=`echo $1 | sed 'y%.=/+- %___p__%'`
196 if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
200 if test -z "`$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then
206 #echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
207 #echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
212 rm -f conftest conftest.c conftest.o
223 #echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
224 #echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
242 if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then
243 DEPFLAG="-MM"
245 if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then
246 DEPFLAG="-xM1"
248 DEPFLAG="-MM" # dunno do something
252 rm -f conftest.c
260 ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"])
261 ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"])
265 …EEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_…
300 …FLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_…
302 …OMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=20…
337 ], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200…
349 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_BSD_SOURCE -D_DEFAULT_SOURCE,
358 ], [CFLAGS="$CFLAGS -D_BSD_SOURCE -D_DEFAULT_SOURCE"])
360 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE,
369 ], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
372 # is not available at all. -D_FRSRESGID is to make this check unique.
374 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE -D_FRSRESGID,
383 ], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
385 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_POSIX_C_SOURCE=200112,
405 ], [CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"])
407 ACX_CHECK_COMPILER_FLAG_NEEDED(-D__EXTENSIONS__,
433 ], [CFLAGS="$CFLAGS -D__EXTENSIONS__"])
437 dnl Check if CC supports -flto.
441 …AC_ARG_ENABLE([flto], AS_HELP_STRING([--disable-flto], [Disable link-time optimization (gcc specif…
443 AC_MSG_CHECKING([if $CC supports -flto])
445 CFLAGS="$CFLAGS -flto"
447 …if $CC $CFLAGS -o conftest conftest.c 2>&1 | $GREP -e "warning: no debug symbols in executable" -e…
453 rm -f conftest conftest.c conftest.o
458 dnl Check the printf-format attribute (if any)
463 AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute)
497 AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute)
528 dnl Pre-fun for ACX_LIBTOOL_C_ONLY
540 if test -z "$libtool"; then
546 if echo "$host_os" | grep "sunos4" >/dev/null; then
623 dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool.
627 [ --disable-rpath disable hardcoded rpath (default=enabled)],
630 dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.])
631 AC_CONFIG_COMMANDS([disable-rpath], [
632 sed < libtool > libtool-2 \
633 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
634 mv libtool-2 libtool
641 dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is
646 if echo "$1" | grep "^/" >/dev/null; then
647 RUNTIME_PATH="$RUNTIME_PATH -R$1"
659 if test -n "$withval"; then
662 dnl and /usr/lib64/openssl11/libssl.so
663 dnl with the --with-ssl=/usr/include/openssl11
664 if test ! -f "$withval/include/openssl/ssl.h" -a -f "$withval/openssl/ssl.h"; then
670 ssldir_lib=`echo $ssldir | sed -e 's/include/lib/'`
671 if test -f "$ssldir_lib/libssl.a" -o -f "$ssldir_lib/libssl.so"; then
674 ssldir_lib=`echo $ssldir | sed -e 's/include/lib64/'`
675 if test -f "$ssldir_lib/libssl.a" -o -f "$ssldir_lib/libssl.so"; then
678 …AC_MSG_ERROR([Could not find openssl lib file, $ssldir_lib/libssl.[so,a], pass like "/usr/local" o…
683 if test x_$withval = x_ -o x_$withval = x_yes; then
688 if test -f "$dir/include/openssl/ssl.h"; then
691 if test ! -d "$ssldir/lib" -a -d "$ssldir/lib64"; then
707 CPPFLAGS="$CPPFLAGS -I$ssldir_include"
708 LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir_include"
709 LDFLAGS="$LDFLAGS -L$ssldir_lib"
710 LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir_lib"
714 AC_MSG_CHECKING([for EVP_sha256 in -lcrypto])
715 LIBS="$LIBS -lcrypto"
716 LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto"
726 # check if -lwsock32 or -lgdi32 are needed.
729 LIBS="$LIBS -lgdi32 -lws2_32"
730 LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32"
731 AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
744 LIBS="$LIBS -lgdi32 -lws2_32 -lcrypt32"
745 LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32 -lcrypt32"
746 AC_MSG_CHECKING([if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32])
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])
774 LIBS="$LIBS -ldl"
775 LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
776 AC_MSG_CHECKING([if -lcrypto needs -ldl])
788 LIBS="$LIBS -ldl -pthread"
789 LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
790 AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread])
817 dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
818 dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
823 AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl=pathname],[enable SSL (will check /usr/local/ssl
834 dnl Check for SSL, where ssl is optional (--without-ssl is allowed)
835 dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
836 dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
841 AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl=pathname],[enable SSL (will check /usr/local/ssl
849 dnl Setup to use -lssl
850 dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one).
853 # check if libssl needs libdl
855 LIBS="-lssl $LIBS"
856 AC_MSG_CHECKING([if libssl needs libdl])
872 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1,
879 ], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"])
911 if echo "$LIBS" | grep 'lws2_32' >/dev/null; then
914 LIBS="$LIBS -lws2_32"
938 LIBS="$LIBS -lws2_32"
952 dnl already: LIBS="$LIBS -lws2_32"
971 dnl $2: C-statement that calls the function.
979 cache=`echo $1 | sed 'y%.=/+-%___p_%'`
984 if test -z "`$CC $CPPFLAGS $CFLAGS -c conftest.c 2>&1 | grep -e deprecated -e unavailable`"; then
989 rm -f conftest conftest.o conftest.c
1010 if echo $host | grep mingw >/dev/null; then
1060 if(sfd == -1) {
1072 if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) {
1078 if(cfd == -1) {
1105 if(p == -1) {
1383 dnl $1: the name of the flag, for example -D_GNU_SOURCE.
1386 if echo $CFLAGS | grep " $1" >/dev/null 2>&1; then
1387 CFLAGS="`echo $CFLAGS | sed -e 's/ $1//g'`"
1388 AC_DEFINE(m4_bpatsubst(OMITTED_$1,[[-=]],_), 1, Put $1 define in config.h)
1397 ACX_CFLAGS_STRIP(-D_GNU_SOURCE)
1398 ACX_CFLAGS_STRIP(-D_BSD_SOURCE)
1399 ACX_CFLAGS_STRIP(-D_DEFAULT_SOURCE)
1400 ACX_CFLAGS_STRIP(-D__EXTENSIONS__)
1401 ACX_CFLAGS_STRIP(-D_POSIX_C_SOURCE=200112)
1402 ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE=600)
1403 ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE_EXTENDED=1)
1404 ACX_CFLAGS_STRIP(-D_ALL_SOURCE)
1405 ACX_CFLAGS_STRIP(-D_LARGEFILE_SOURCE=1)
1409 dnl $1: flag name. -D_GNU_SOURCE
1417 dnl Wrapper for AHX_CONFIG_FLAG_OMITTED for -D style flags
1418 dnl $1: the -DNAME or -DNAME=value string.
1420 …_FLAG_OMITTED(m4_bpatsubst(OMITTED_$1,[[-=]],_),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_…
1425 [AHX_CONFIG_FLAG_EXT(-D_GNU_SOURCE)
1426 AHX_CONFIG_FLAG_EXT(-D_BSD_SOURCE)
1427 AHX_CONFIG_FLAG_EXT(-D_DEFAULT_SOURCE)
1428 AHX_CONFIG_FLAG_EXT(-D__EXTENSIONS__)
1429 AHX_CONFIG_FLAG_EXT(-D_POSIX_C_SOURCE=200112)
1430 AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE=600)
1431 AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE_EXTENDED=1)
1432 AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE)
1433 AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1)
1454 ], [ AC_MSG_RESULT([cross-compile no])
1468 dnl ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family
1502 dnl Check if CC and linker support -fPIE and -pie.
1505 …AC_ARG_ENABLE([pie], AS_HELP_STRING([--enable-pie], [Enable Position-Independent Executable (eg. t…
1510 LDFLAGS="$LDFLAGS -pie"
1511 CFLAGS="$CFLAGS -fPIE"
1513 …if $CC $CFLAGS $LDFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executabl…
1519 rm -f conftest conftest.c conftest.o
1524 dnl Check if linker supports -Wl,-z,relro,-z,now.
1527 …AC_ARG_ENABLE([relro_now], AS_HELP_STRING([--enable-relro-now], [Enable full relocation binding at…
1529 AC_MSG_CHECKING([if $CC supports -Wl,-z,relro,-z,now])
1531 LDFLAGS="$LDFLAGS -Wl,-z,relro,-z,now"
1533 …if $CC $CFLAGS $LDFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executabl…
1539 rm -f conftest conftest.c conftest.o