xref: /freebsd/contrib/ntp/sntp/m4/ntp_openssl.m4 (revision f0574f5cf69e168cc4ea71ebbe5fdec9ec9a3dfe)
12b15cb3dSCy Schubertdnl ####################################################################
22b15cb3dSCy Schubertdnl OpenSSL support shared by top-level and sntp/configure.ac
32b15cb3dSCy Schubertdnl
42b15cb3dSCy Schubertdnl Provides command-line option --with-crypto, as well as deprecated
52b15cb3dSCy Schubertdnl options --with-openssl-incdir, --with-openssl-libdir, and the
62b15cb3dSCy Schubertdnl latter's suboption --with-rpath.
72b15cb3dSCy Schubertdnl
82b15cb3dSCy Schubertdnl Specifying --with-openssl-libdir or --with-openssl-incdir causes any
92b15cb3dSCy Schubertdnl pkg-config openssl information to be ignored in favor of the legacy
102b15cb3dSCy Schubertdnl manual search for directories and specified library names.
112b15cb3dSCy Schubertdnl
122b15cb3dSCy Schubertdnl Output AC_DEFINEs (for config.h)
132b15cb3dSCy Schubertdnl	OPENSSL		defined only if using OpenSSL
142b15cb3dSCy Schubertdnl
152b15cb3dSCy Schubertdnl Output variables:
162b15cb3dSCy Schubertdnl	ntp_openssl	yes if using OpenSSL, no otherwise
172b15cb3dSCy Schubertdnl
182b15cb3dSCy Schubertdnl Output substitutions:
192b15cb3dSCy Schubertdnl	CFLAGS_NTP	OpenSSL-specific flags added as needed, and
202b15cb3dSCy Schubertdnl			-Wstrict-prototypes for gcc if it does not
212b15cb3dSCy Schubertdnl			trigger a flood of warnings for each file
222b15cb3dSCy Schubertdnl			including OpenSSL headers.
232b15cb3dSCy Schubertdnl	CPPFLAGS_NTP	OpenSSL -Iincludedir flags added as needed.
242b15cb3dSCy Schubertdnl	LDADD_NTP	OpenSSL -L and -l flags added as needed.
252b15cb3dSCy Schubertdnl	LDFLAGS_NTP	Other OpenSSL link flags added as needed.
262b15cb3dSCy Schubertdnl
272b15cb3dSCy Schubertdnl ####################################################################
282b15cb3dSCy SchubertAC_DEFUN([NTP_OPENSSL], [
292b15cb3dSCy SchubertAC_REQUIRE([NTP_PKG_CONFIG])dnl
302b15cb3dSCy SchubertAC_REQUIRE([NTP_VER_SUFFIX])dnl
312b15cb3dSCy Schubert
322b15cb3dSCy SchubertAC_ARG_WITH(
332b15cb3dSCy Schubert    [crypto],
342b15cb3dSCy Schubert    [AS_HELP_STRING(
352b15cb3dSCy Schubert	[--with-crypto],
362b15cb3dSCy Schubert	[+ =openssl,libcrypto]
372b15cb3dSCy Schubert    )]
382b15cb3dSCy Schubert)
392b15cb3dSCy SchubertAC_ARG_WITH(
402b15cb3dSCy Schubert    [openssl-libdir],
412b15cb3dSCy Schubert    [AS_HELP_STRING(
422b15cb3dSCy Schubert	[--with-openssl-libdir],
432b15cb3dSCy Schubert	[+ =/something/reasonable]
442b15cb3dSCy Schubert    )]
452b15cb3dSCy Schubert)
462b15cb3dSCy SchubertAC_ARG_WITH(
472b15cb3dSCy Schubert    [openssl-incdir],
482b15cb3dSCy Schubert    [AS_HELP_STRING(
492b15cb3dSCy Schubert	[--with-openssl-incdir],
502b15cb3dSCy Schubert	[+ =/something/reasonable]
512b15cb3dSCy Schubert    )]
522b15cb3dSCy Schubert)
532b15cb3dSCy SchubertAC_ARG_WITH(
542b15cb3dSCy Schubert    [rpath],
552b15cb3dSCy Schubert    [AS_HELP_STRING(
562b15cb3dSCy Schubert	[--without-rpath],
572b15cb3dSCy Schubert	[s Disable auto-added -R linker paths]
582b15cb3dSCy Schubert    )]
592b15cb3dSCy Schubert)
60*f0574f5cSXin LI
612b15cb3dSCy Schubertntp_openssl=no
622b15cb3dSCy Schubertntp_openssl_from_pkg_config=no
63*f0574f5cSXin LI
642b15cb3dSCy Schubertwith_crypto=${with_crypto:-openssl,libcrypto}
652b15cb3dSCy Schubertcase "$with_crypto" in
662b15cb3dSCy Schubert yes)
672b15cb3dSCy Schubert    with_crypto=openssl,libcrypto
682b15cb3dSCy Schubertesac
69*f0574f5cSXin LI
70*f0574f5cSXin LIdnl AC_MSG_NOTICE(['%with_crypto:%{PKG_CONFIG:+notempty}:%{with_openssl_libdir-notgiven}:%{with_openssl_incdir-notgiven}'])
71*f0574f5cSXin LIdnl str="$with_crypto:${PKG_CONFIG:+notempty}:${with_openssl_libdir-notgiven}:${with_openssl_incdir-notgiven}"
72*f0574f5cSXin LIdnl AC_MSG_NOTICE([$str])
73*f0574f5cSXin LI
742b15cb3dSCy Schubertcase "$with_crypto:${PKG_CONFIG:+notempty}:${with_openssl_libdir-notgiven}:${with_openssl_incdir-notgiven}" in
752b15cb3dSCy Schubert no:*) ;;
762b15cb3dSCy Schubert *:notempty:notgiven:notgiven)
772b15cb3dSCy Schubert    for pkg in `echo $with_crypto | sed -e 's/,/ /'`; do
782b15cb3dSCy Schubert	AC_MSG_CHECKING([pkg-config for $pkg])
792b15cb3dSCy Schubert	if $PKG_CONFIG --exists $pkg ; then
802b15cb3dSCy Schubert	    CPPFLAGS_NTP="$CPPFLAGS_NTP `$PKG_CONFIG --cflags-only-I $pkg`"
812b15cb3dSCy Schubert	    CFLAGS_NTP="$CFLAGS_NTP `$PKG_CONFIG --cflags-only-other $pkg`"
822b15cb3dSCy Schubert	    LDADD_NTP="$LDADD_NTP `$PKG_CONFIG --libs-only-L $pkg`"
83*f0574f5cSXin LI	    LDADD_NTP="$LDADD_NTP `$PKG_CONFIG --libs-only-l --static $pkg`"
842b15cb3dSCy Schubert	    LDFLAGS_NTP="$LDFLAGS_NTP `$PKG_CONFIG --libs-only-other $pkg`"
852b15cb3dSCy Schubert	    VER_SUFFIX=o
862b15cb3dSCy Schubert	    ntp_openssl=yes
872b15cb3dSCy Schubert	    ntp_openssl_from_pkg_config=yes
882b15cb3dSCy Schubert	    AC_MSG_RESULT([yes])
892b15cb3dSCy Schubert
902b15cb3dSCy Schubert	    break
912b15cb3dSCy Schubert	fi
922b15cb3dSCy Schubert	AC_MSG_RESULT([no])
932b15cb3dSCy Schubert    done
942b15cb3dSCy Schubertesac
95*f0574f5cSXin LIdnl AC_MSG_NOTICE([OpenSSL Phase I checks:])
96*f0574f5cSXin LIdnl AC_MSG_NOTICE([CPPFLAGS_NTP: $CPPFLAGS_NTP])
97*f0574f5cSXin LIdnl AC_MSG_NOTICE([CFLAGS_NTP: $CFLAGS_NTP])
98*f0574f5cSXin LIdnl AC_MSG_NOTICE([LDADD_NTP: $LDADD_NTP])
99*f0574f5cSXin LIdnl AC_MSG_NOTICE([LDFLAGS_NTP: $LDFLAGS_NTP])
1002b15cb3dSCy Schubertcase "$with_crypto:$ntp_openssl" in
1012b15cb3dSCy Schubert no:*) ;;
1022b15cb3dSCy Schubert *:no)
1032b15cb3dSCy Schubert    need_dash_r=
1042b15cb3dSCy Schubert    need_dash_Wlrpath=
1052b15cb3dSCy Schubert    case "${with_rpath-notgiven}" in
1062b15cb3dSCy Schubert     yes)
1072b15cb3dSCy Schubert	# Lame - what to do if we need -Wl... but not -R?
1082b15cb3dSCy Schubert	need_dash_r=1
1092b15cb3dSCy Schubert	;;
1102b15cb3dSCy Schubert     notgiven)
1112b15cb3dSCy Schubert	case "$host" in
1122b15cb3dSCy Schubert	 *-*-linux*)
1132b15cb3dSCy Schubert	    # This may really only be true for gcc
1142b15cb3dSCy Schubert	    need_dash_Wlrpath=1
1152b15cb3dSCy Schubert	    ;;
1162b15cb3dSCy Schubert	 *-*-netbsd*)
1172b15cb3dSCy Schubert	    need_dash_r=1
1182b15cb3dSCy Schubert	    ;;
1192b15cb3dSCy Schubert	 *-*-solaris*)
1202b15cb3dSCy Schubert	    need_dash_r=1
1212b15cb3dSCy Schubert	    ;;
1222b15cb3dSCy Schubert	esac
1232b15cb3dSCy Schubert	;;
1242b15cb3dSCy Schubert    esac
1252b15cb3dSCy Schubert
1262b15cb3dSCy Schubert    AC_MSG_CHECKING([for openssl library directory])
1272b15cb3dSCy Schubert    with_openssl_libdir=${with_openssl_libdir-notgiven}
1282b15cb3dSCy Schubert    case "$with_openssl_libdir" in
1292b15cb3dSCy Schubert     notgiven)
1302b15cb3dSCy Schubert	case "$build" in
1312b15cb3dSCy Schubert	 $host)
1322b15cb3dSCy Schubert	    with_openssl_libdir=default
1332b15cb3dSCy Schubert	    ;;
1342b15cb3dSCy Schubert	 *)
1352b15cb3dSCy Schubert	    with_openssl_libdir=no
1362b15cb3dSCy Schubert	    ;;
1372b15cb3dSCy Schubert	esac
1382b15cb3dSCy Schubert    esac
1392b15cb3dSCy Schubert    case "$with_openssl_libdir" in
1402b15cb3dSCy Schubert     default)
1412b15cb3dSCy Schubert	# Look in:
1422b15cb3dSCy Schubert	with_openssl_libdir="/usr/lib /usr/lib/openssl /usr/sfw/lib"
1432b15cb3dSCy Schubert	with_openssl_libdir="$with_openssl_libdir /usr/local/lib"
1442b15cb3dSCy Schubert	with_openssl_libdir="$with_openssl_libdir /usr/local/ssl/lib /lib"
1452b15cb3dSCy Schubert    esac
1462b15cb3dSCy Schubert    case "$with_openssl_libdir" in
1472b15cb3dSCy Schubert     no)
1482b15cb3dSCy Schubert	;;
1492b15cb3dSCy Schubert     *) # Look for libcrypto.a and libssl.a:
1502b15cb3dSCy Schubert	for i in $with_openssl_libdir no
1512b15cb3dSCy Schubert	do
1522b15cb3dSCy Schubert	    case "$host" in
1532b15cb3dSCy Schubert	     *-*-darwin*)
1542b15cb3dSCy Schubert		test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
1552b15cb3dSCy Schubert		;;
1562b15cb3dSCy Schubert	     *)
1572b15cb3dSCy Schubert		test -f $i/libcrypto.so -a -f $i/libssl.so && break
1582b15cb3dSCy Schubert		test -f $i/libcrypto.a -a -f $i/libssl.a && break
1592b15cb3dSCy Schubert		;;
1602b15cb3dSCy Schubert	    esac
1612b15cb3dSCy Schubert	done
1622b15cb3dSCy Schubert	openssl_libdir=$i
1632b15cb3dSCy Schubert	;;
1642b15cb3dSCy Schubert    esac
1652b15cb3dSCy Schubert    AC_MSG_RESULT([$openssl_libdir])
1662b15cb3dSCy Schubert    case "$openssl_libdir" in
1672b15cb3dSCy Schubert     no)
1682b15cb3dSCy Schubert	openssl_libdir=
1692b15cb3dSCy Schubert	AC_MSG_WARN([libcrypto and libssl not found in any of $with_openssl_libdir])
1702b15cb3dSCy Schubert    esac
1712b15cb3dSCy Schubert
1722b15cb3dSCy Schubert    AC_MSG_CHECKING([for openssl include directory])
1732b15cb3dSCy Schubert    with_openssl_incdir=${with_openssl_incdir-notgiven}
1742b15cb3dSCy Schubert    case "$with_openssl_incdir" in
1752b15cb3dSCy Schubert     notgiven)
1762b15cb3dSCy Schubert	# Look in:
1772b15cb3dSCy Schubert	with_openssl_incdir="/usr/include /usr/sfw/include"
1782b15cb3dSCy Schubert	with_openssl_incdir="$with_openssl_incdir /usr/local/include"
1792b15cb3dSCy Schubert	with_openssl_incdir="$with_openssl_incdir /usr/local/ssl/include"
1802b15cb3dSCy Schubert    esac
1812b15cb3dSCy Schubert    case "$with_openssl_incdir" in
1822b15cb3dSCy Schubert     no)
1832b15cb3dSCy Schubert	;;
1842b15cb3dSCy Schubert     *) # look for openssl/evp.h:
1852b15cb3dSCy Schubert	for i in $with_openssl_incdir no
1862b15cb3dSCy Schubert	do
1872b15cb3dSCy Schubert	    test -f $i/openssl/evp.h && break
1882b15cb3dSCy Schubert	done
1892b15cb3dSCy Schubert	openssl_incdir=$i
1902b15cb3dSCy Schubert	;;
1912b15cb3dSCy Schubert    esac
1922b15cb3dSCy Schubert    AS_UNSET([i])
1932b15cb3dSCy Schubert    AC_MSG_RESULT([$openssl_incdir])
1942b15cb3dSCy Schubert    case "$openssl_incdir" in
1952b15cb3dSCy Schubert     no)
1962b15cb3dSCy Schubert	openssl_incdir=
1972b15cb3dSCy Schubert	AC_MSG_WARN([did not find openssl/evp.h in any of $with_openssl_incdir])
1982b15cb3dSCy Schubert    esac
1992b15cb3dSCy Schubert    if test -z "$openssl_libdir" -o -z "$openssl_incdir"
2002b15cb3dSCy Schubert    then
2012b15cb3dSCy Schubert	ntp_openssl=no
2022b15cb3dSCy Schubert    else
2032b15cb3dSCy Schubert	ntp_openssl=yes
2042b15cb3dSCy Schubert	VER_SUFFIX=o
2052b15cb3dSCy Schubert    fi
2062b15cb3dSCy Schubert    case "$ntp_openssl" in
2072b15cb3dSCy Schubert     yes)
2082b15cb3dSCy Schubert	# We have OpenSSL inc/lib dirs - use them.
2092b15cb3dSCy Schubert	case "$openssl_incdir" in
2102b15cb3dSCy Schubert	 /usr/include)
2112b15cb3dSCy Schubert	    ;;
2122b15cb3dSCy Schubert	 *)
2132b15cb3dSCy Schubert	    CPPFLAGS_NTP="$CPPFLAGS_NTP -I$openssl_incdir"
2142b15cb3dSCy Schubert	    ;;
2152b15cb3dSCy Schubert	esac
2162b15cb3dSCy Schubert	case "$openssl_libdir" in
2172b15cb3dSCy Schubert	 /usr/lib)
2182b15cb3dSCy Schubert	    ;;
2192b15cb3dSCy Schubert	 *)
2202b15cb3dSCy Schubert	    LDADD_NTP="$LDADD_NTP -L$openssl_libdir"
2212b15cb3dSCy Schubert	    case "$need_dash_r" in
2222b15cb3dSCy Schubert	     1)
2232b15cb3dSCy Schubert		LDFLAGS_NTP="$LDFLAGS_NTP -R$openssl_libdir"
2242b15cb3dSCy Schubert	    esac
2252b15cb3dSCy Schubert	    case "$need_dash_Wlrpath" in
2262b15cb3dSCy Schubert	     1)
2272b15cb3dSCy Schubert		LDFLAGS_NTP="$LDFLAGS_NTP -Wl,-rpath,$openssl_libdir"
2282b15cb3dSCy Schubert	    esac
2292b15cb3dSCy Schubert	    ;;
2302b15cb3dSCy Schubert	esac
2312b15cb3dSCy Schubert	LDADD_NTP="$LDADD_NTP -lcrypto"
2322b15cb3dSCy Schubert    esac
2332b15cb3dSCy Schubertesac
2342b15cb3dSCy Schubert
2352b15cb3dSCy SchubertAC_MSG_CHECKING([if we will use crypto])
2362b15cb3dSCy SchubertAC_MSG_RESULT([$ntp_openssl])
2372b15cb3dSCy Schubert
2382b15cb3dSCy Schubertcase "$ntp_openssl" in
2392b15cb3dSCy Schubert yes)
2402b15cb3dSCy Schubert    AC_DEFINE([OPENSSL], [], [Use OpenSSL?])
2412b15cb3dSCy Schubert    case "$VER_SUFFIX" in
2422b15cb3dSCy Schubert     *o*) ;;
2432b15cb3dSCy Schubert     *) AC_MSG_ERROR([OPENSSL set but no 'o' in VER_SUFFIX!]) ;;
2442b15cb3dSCy Schubert    esac
2452b15cb3dSCy Schubert    ;;
2462b15cb3dSCy Schubertesac
2472b15cb3dSCy Schubert
2482b15cb3dSCy SchubertNTPO_SAVED_CPPFLAGS="$CPPFLAGS"
2492b15cb3dSCy SchubertCPPFLAGS="$CPPFLAGS $CPPFLAGS_NTP"
2502b15cb3dSCy SchubertNTPO_SAVED_LIBS="$LIBS"
2512b15cb3dSCy Schubert
2522b15cb3dSCy Schubert#
2532b15cb3dSCy Schubert# check for linking with -lcrypto failure, and try -lcrypto -lz.
2542b15cb3dSCy Schubert# Helps m68k-atari-mint
2552b15cb3dSCy Schubert#
2562b15cb3dSCy Schubertcase "$ntp_openssl:$ntp_openssl_from_pkg_config" in
2572b15cb3dSCy Schubert yes:no)
2582b15cb3dSCy Schubert    LIBS="$NTPO_SAVED_LIBS $LDADD_NTP"
2592b15cb3dSCy Schubert    AC_CACHE_CHECK(
2602b15cb3dSCy Schubert	[if linking with -lcrypto alone works],
2612b15cb3dSCy Schubert	[ntp_cv_bare_lcrypto],
2622b15cb3dSCy Schubert	[AC_LINK_IFELSE(
2632b15cb3dSCy Schubert	    [AC_LANG_PROGRAM(
2642b15cb3dSCy Schubert		[[
2652b15cb3dSCy Schubert		    #include "openssl/err.h"
2662b15cb3dSCy Schubert		    #include "openssl/evp.h"
2672b15cb3dSCy Schubert		]],
2682b15cb3dSCy Schubert		[[
2692b15cb3dSCy Schubert		    ERR_load_crypto_strings();
2702b15cb3dSCy Schubert		    OpenSSL_add_all_algorithms();
2712b15cb3dSCy Schubert		]]
2722b15cb3dSCy Schubert	    )],
2732b15cb3dSCy Schubert	    [ntp_cv_bare_lcrypto=yes],
2742b15cb3dSCy Schubert	    [ntp_cv_bare_lcrypto=no]
2752b15cb3dSCy Schubert	)]
2762b15cb3dSCy Schubert    )
2772b15cb3dSCy Schubert    case "$ntp_cv_bare_lcrypto" in
2782b15cb3dSCy Schubert     no)
2792b15cb3dSCy Schubert	LIBS="$NTPO_SAVED_LIBS $LDADD_NTP -lz"
2802b15cb3dSCy Schubert	AC_CACHE_CHECK(
2812b15cb3dSCy Schubert	    [if linking with -lcrypto -lz works],
2822b15cb3dSCy Schubert	    [ntp_cv_lcrypto_lz],
2832b15cb3dSCy Schubert	    [AC_LINK_IFELSE(
2842b15cb3dSCy Schubert		[AC_LANG_PROGRAM(
2852b15cb3dSCy Schubert		    [[
2862b15cb3dSCy Schubert			#include "openssl/err.h"
2872b15cb3dSCy Schubert			#include "openssl/evp.h"
2882b15cb3dSCy Schubert		    ]],
2892b15cb3dSCy Schubert		    [[
2902b15cb3dSCy Schubert			ERR_load_crypto_strings();
2912b15cb3dSCy Schubert			OpenSSL_add_all_algorithms();
2922b15cb3dSCy Schubert		    ]]
2932b15cb3dSCy Schubert		)],
2942b15cb3dSCy Schubert		[ntp_cv_lcrypto_lz=yes],
2952b15cb3dSCy Schubert		[ntp_cv_lcrypto_lz=no]
2962b15cb3dSCy Schubert	    )]
2972b15cb3dSCy Schubert	)
2982b15cb3dSCy Schubert	case "$ntp_cv_lcrypto_lz" in
2992b15cb3dSCy Schubert	 yes)
3002b15cb3dSCy Schubert	     LDADD_NTP="$LDADD_NTP -lz"
3012b15cb3dSCy Schubert	esac
3022b15cb3dSCy Schubert    esac
3032b15cb3dSCy Schubertesac
3042b15cb3dSCy Schubert
3052b15cb3dSCy Schubert#
3062b15cb3dSCy Schubert# Older OpenSSL headers have a number of callback prototypes inside
3072b15cb3dSCy Schubert# other function prototypes which trigger copious warnings with gcc's
3082b15cb3dSCy Schubert# -Wstrict-prototypes, which is included in -Wall.
3092b15cb3dSCy Schubert#
3102b15cb3dSCy Schubert# An example:
3112b15cb3dSCy Schubert#
3122b15cb3dSCy Schubert# int i2d_RSA_NET(const RSA *a, unsigned char **pp,
3132b15cb3dSCy Schubert#		  int (*cb)(), int sgckey);
3142b15cb3dSCy Schubert#		  ^^^^^^^^^^^
3152b15cb3dSCy Schubert#
3162b15cb3dSCy Schubert#
3172b15cb3dSCy Schubert#
3182b15cb3dSCy Schubertopenssl_triggers_warnings=unknown
3192b15cb3dSCy SchubertNTPO_SAVED_CFLAGS="$CFLAGS"
3202b15cb3dSCy Schubert
3212b15cb3dSCy Schubertcase "$ntp_openssl:$GCC" in
3222b15cb3dSCy Schubert yes:yes)
3232b15cb3dSCy Schubert    CFLAGS="$CFLAGS -Werror"
3242b15cb3dSCy Schubert    AC_COMPILE_IFELSE(
3252b15cb3dSCy Schubert	[AC_LANG_PROGRAM(
3262b15cb3dSCy Schubert	    [[
3272b15cb3dSCy Schubert	    ]],
3282b15cb3dSCy Schubert	    [[
3292b15cb3dSCy Schubert		/* see if -Werror breaks gcc */
3302b15cb3dSCy Schubert	    ]]
3312b15cb3dSCy Schubert	)],
3322b15cb3dSCy Schubert	[gcc_handles_Werror=yes],
3332b15cb3dSCy Schubert	[gcc_handles_Werror=no]
3342b15cb3dSCy Schubert    )
3352b15cb3dSCy Schubert    case "$gcc_handles_Werror" in
3362b15cb3dSCy Schubert     no)
3372b15cb3dSCy Schubert	# if this gcc doesn't do -Werror go ahead and use
3382b15cb3dSCy Schubert	# -Wstrict-prototypes.
3392b15cb3dSCy Schubert	openssl_triggers_warnings=yes
3402b15cb3dSCy Schubert	;;
3412b15cb3dSCy Schubert     yes)
3422b15cb3dSCy Schubert	CFLAGS="$CFLAGS -Wstrict-prototypes"
3432b15cb3dSCy Schubert	AC_COMPILE_IFELSE(
3442b15cb3dSCy Schubert	    [AC_LANG_PROGRAM(
3452b15cb3dSCy Schubert		[[
3462b15cb3dSCy Schubert		    #include "openssl/asn1_mac.h"
3472b15cb3dSCy Schubert		    #include "openssl/bn.h"
3482b15cb3dSCy Schubert		    #include "openssl/err.h"
3492b15cb3dSCy Schubert		    #include "openssl/evp.h"
3502b15cb3dSCy Schubert		    #include "openssl/pem.h"
3512b15cb3dSCy Schubert		    #include "openssl/rand.h"
3522b15cb3dSCy Schubert		    #include "openssl/x509v3.h"
3532b15cb3dSCy Schubert		]],
3542b15cb3dSCy Schubert		[[
3552b15cb3dSCy Schubert		    /* empty body */
3562b15cb3dSCy Schubert		]]
3572b15cb3dSCy Schubert	    )],
3582b15cb3dSCy Schubert	    [openssl_triggers_warnings=no],
3592b15cb3dSCy Schubert	    [openssl_triggers_warnings=yes]
3602b15cb3dSCy Schubert	)
3612b15cb3dSCy Schubert    esac
3622b15cb3dSCy Schubert    case "$openssl_triggers_warnings" in
3632b15cb3dSCy Schubert     yes)
3642b15cb3dSCy Schubert	CFLAGS_NTP="$CFLAGS_NTP -Wno-strict-prototypes"
3652b15cb3dSCy Schubert	;;
3662b15cb3dSCy Schubert     *)
3672b15cb3dSCy Schubert	CFLAGS_NTP="$CFLAGS_NTP -Wstrict-prototypes"
3682b15cb3dSCy Schubert    esac
3692b15cb3dSCy Schubert    ;;
3702b15cb3dSCy Schubert no:yes)
3712b15cb3dSCy Schubert    # gcc without OpenSSL
3722b15cb3dSCy Schubert    CFLAGS_NTP="$CFLAGS_NTP -Wstrict-prototypes"
3732b15cb3dSCy Schubertesac
3742b15cb3dSCy Schubert
375276da39aSCy Schubert# Because we don't want -Werror for the EVP_MD_do_all_sorted check
3762b15cb3dSCy SchubertCFLAGS="$NTPO_SAVED_CFLAGS"
377276da39aSCy Schubert
378276da39aSCy Schubertcase "$ntp_openssl" in
379276da39aSCy Schubert yes)
380276da39aSCy Schubert    LIBS="$NTPO_SAVED_LIBS $LDADD_NTP"
381276da39aSCy Schubert    AC_CHECK_FUNCS([EVP_MD_do_all_sorted])
382276da39aSCy Schubert    ;;
383276da39aSCy Schubertesac
384276da39aSCy Schubert
385*f0574f5cSXin LIdnl AC_MSG_NOTICE([OpenSSL final checks:])
386*f0574f5cSXin LIdnl AC_MSG_NOTICE([CPPFLAGS_NTP: $CPPFLAGS_NTP])
387*f0574f5cSXin LIdnl AC_MSG_NOTICE([CFLAGS_NTP: $CFLAGS_NTP])
388*f0574f5cSXin LIdnl AC_MSG_NOTICE([LDADD_NTP: $LDADD_NTP])
389*f0574f5cSXin LIdnl AC_MSG_NOTICE([LDFLAGS_NTP: $LDFLAGS_NTP])
390*f0574f5cSXin LI
3912b15cb3dSCy SchubertCPPFLAGS="$NTPO_SAVED_CPPFLAGS"
3922b15cb3dSCy SchubertLIBS="$NTPO_SAVED_LIBS"
3932b15cb3dSCy SchubertAS_UNSET([NTPO_SAVED_CFLAGS])
3942b15cb3dSCy SchubertAS_UNSET([NTPO_SAVED_CPPFLAGS])
3952b15cb3dSCy SchubertAS_UNSET([NTPO_SAVED_LIBS])
3962b15cb3dSCy SchubertAS_UNSET([openssl_triggers_warnings])
3972b15cb3dSCy SchubertAS_UNSET([ntp_openssl_from_pkg_config])
3982b15cb3dSCy Schubert])
3992b15cb3dSCy Schubertdnl ======================================================================
400