dnl
dnl Output variables:
dnl ntp_openssl yes if using OpenSSL, no otherwise
+dnl VER_SUFFIX "o" if using OpenSSL
dnl
dnl Output substitutions:
dnl CFLAGS_NTP OpenSSL-specific flags added as needed, and
dnl
dnl ####################################################################
AC_DEFUN([NTP_OPENSSL], [
+AC_REQUIRE([AC_PROG_SED])
AC_REQUIRE([NTP_PKG_CONFIG])dnl
AC_REQUIRE([NTP_VER_SUFFIX])dnl
[AS_HELP_STRING(
[--with-crypto],
[+ =openssl,libcrypto]
- )]
+ )],
+ [ dnl if given
+ case "$with_crypto" in
+ yes)
+ with_crypto=openssl,libcrypto
+ esac
+ ],
+ [with_crypto=openssl,libcrypto] dnl if not given
)
AC_ARG_WITH(
[openssl-libdir],
[openssl-incdir],
[AS_HELP_STRING(
[--with-openssl-incdir],
- [+ =/something/reasonable]
- )]
-)
-AC_ARG_WITH(
- [rpath],
- [AS_HELP_STRING(
- [--without-rpath],
- [s Disable auto-added -R linker paths]
+ [+ =search likely dirs]
)]
)
ntp_openssl=no
ntp_openssl_from_pkg_config=no
+ntp_ssl_incdir=
+ntp_ssl_cflags=
+ntp_ssl_libdir=
+ntp_ssl_libs_l=
+ntp_ssl_ldflags=
-with_crypto=${with_crypto:-openssl,libcrypto}
-case "$with_crypto" in
- yes)
- with_crypto=openssl,libcrypto
-esac
+NTPSSL_SAVED_CFLAGS="$CFLAGS"
+NTPSSL_SAVED_CPPFLAGS="$CPPFLAGS"
+NTPSSL_SAVED_LIBS="$LIBS"
+NTPSSL_SAVED_LDFLAGS="$LDFLAGS"
-dnl AC_MSG_NOTICE(['%with_crypto:%{PKG_CONFIG:+notempty}:%{with_openssl_libdir-notgiven}:%{with_openssl_incdir-notgiven}'])
+dnl AC_MSG_NOTICE(['%with_crypto:%{PKG_CONFIG:+notempty}:%{with_openssl_libdir-notgiven}:%{with_ntp_ssl_incdir-notgiven}'])
dnl str="$with_crypto:${PKG_CONFIG:+notempty}:${with_openssl_libdir-notgiven}:${with_openssl_incdir-notgiven}"
dnl AC_MSG_NOTICE([$str])
case "$with_crypto:${PKG_CONFIG:+notempty}:${with_openssl_libdir-notgiven}:${with_openssl_incdir-notgiven}" in
no:*) ;;
*:notempty:notgiven:notgiven)
- for pkg in `echo $with_crypto | sed -e 's/,/ /'`; do
+ for pkg in `echo $with_crypto | $SED -e 's/,/ /'`; do
AC_MSG_CHECKING([pkg-config for $pkg])
if $PKG_CONFIG --exists $pkg ; then
- CPPFLAGS_NTP="$CPPFLAGS_NTP `$PKG_CONFIG --cflags-only-I $pkg`"
- CFLAGS_NTP="$CFLAGS_NTP `$PKG_CONFIG --cflags-only-other $pkg`"
- LDADD_NTP="$LDADD_NTP `$PKG_CONFIG --libs-only-L $pkg`"
- LDADD_NTP="$LDADD_NTP `$PKG_CONFIG --libs-only-l --static $pkg`"
- LDFLAGS_NTP="$LDFLAGS_NTP `$PKG_CONFIG --libs-only-other $pkg`"
- VER_SUFFIX=o
+ ntp_ssl_incdir="`$PKG_CONFIG --cflags-only-I $pkg`"
+ case "$ntp_ssl_incdir=" in
+ '')
+ ;;
+ *)
+ ntp_ssl_incdir="`echo $ntp_ssl_incdir | $SED -e 's/-I//'`"
+ esac
+ ntp_ssl_cflags="`$PKG_CONFIG --cflags-only-other $pkg`"
+ ntp_ssl_libdir="`$PKG_CONFIG --libs-only-L $pkg`"
+ case "$ntp_ssl_libdir" in
+ '')
+ ;;
+ *)
+ ntp_ssl_libdir="`echo $ntp_ssl_libdir | $SED -e 's/-L//'`"
+ esac
+ ntp_ssl_libs_l="`$PKG_CONFIG --libs-only-l $pkg`"
+ ntp_ssl_ldflags="`$PKG_CONFIG --libs-only-other $pkg`"
ntp_openssl=yes
ntp_openssl_from_pkg_config=yes
ntp_openssl_version="`$PKG_CONFIG --modversion $pkg`"
AC_MSG_RESULT([no])
done
esac
+
dnl AC_MSG_NOTICE([OpenSSL Phase I checks:])
dnl AC_MSG_NOTICE([CPPFLAGS_NTP: $CPPFLAGS_NTP])
dnl AC_MSG_NOTICE([CFLAGS_NTP: $CFLAGS_NTP])
dnl AC_MSG_NOTICE([LDADD_NTP: $LDADD_NTP])
dnl AC_MSG_NOTICE([LDFLAGS_NTP: $LDFLAGS_NTP])
-case "$with_crypto:$ntp_openssl" in
- no:*) ;;
- *:no)
- need_dash_r=
- need_dash_Wlrpath=
- case "${with_rpath-notgiven}" in
- yes)
- # Lame - what to do if we need -Wl... but not -R?
- need_dash_r=1
- ;;
- notgiven)
- case "$host" in
- *-*-linux*)
- # This may really only be true for gcc
- need_dash_Wlrpath=1
- ;;
- *-*-netbsd*)
- need_dash_r=1
- ;;
- *-*-solaris*)
- need_dash_r=1
- ;;
- esac
- ;;
- esac
+dnl AC_MSG_NOTICE([ntp_ssl_cflags: $ntp_ssl_cflags])
+dnl AC_MSG_NOTICE([ntp_openssl_from_pkg_config: $ntp_openssl_from_pkg_config])
+dnl AC_MSG_NOTICE([ntp_ssl_incdir: $ntp_ssl_incdir])
+dnl AC_MSG_NOTICE([ntp_ssl_libdir: $ntp_ssl_libdir])
+dnl AC_MSG_NOTICE([ntp_ssl_libs_l: $ntp_ssl_libs_l])
+dnl AC_MSG_NOTICE([ntp_ssl_ldflags: $ntp_ssl_ldflags])
+
+case "$with_crypto" in
+ no)
+ ntp_openssl=no
+ ;;
+ *)
+ dnl ### set ntp_ssl_libdir ###
AC_MSG_CHECKING([for openssl library directory])
- with_openssl_libdir=${with_openssl_libdir-notgiven}
+
case "$with_openssl_libdir" in
- notgiven)
- case "$build" in
- $host)
- with_openssl_libdir=default
+ '')
+ case "$ntp_ssl_libdir" in
+ '')
+ ntp_ssl_libdir_search="/usr/lib /usr/lib/openssl /usr/sfw/lib"
+ ntp_ssl_libdir_search="$ntp_ssl_libdir_search /usr/local/lib"
+ ntp_ssl_libdir_search="$ntp_ssl_libdir_search /opt/local/lib"
+ ntp_ssl_libdir_search="$ntp_ssl_libdir_search /usr/local/ssl/lib"
+ ntp_ssl_libdir_search="$ntp_ssl_libdir_search /lib /lib64"
;;
*)
- with_openssl_libdir=no
- ;;
+ ntp_ssl_libdir_search="$ntp_ssl_libdir"
esac
- esac
- case "$with_openssl_libdir" in
- default)
- # Look in:
- with_openssl_libdir="/usr/lib /usr/lib/openssl /usr/sfw/lib"
- with_openssl_libdir="$with_openssl_libdir /usr/local/lib"
- with_openssl_libdir="$with_openssl_libdir /usr/local/ssl/lib /lib"
- esac
- case "$with_openssl_libdir" in
- no)
- ;;
- *) # Look for libcrypto.a and libssl.a:
- for i in $with_openssl_libdir no
- do
- case "$host" in
- *-*-darwin*)
- test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
- ;;
- *)
- test -f $i/libcrypto.so -a -f $i/libssl.so && break
- test -f $i/libcrypto.a -a -f $i/libssl.a && break
- ;;
- esac
- done
- openssl_libdir=$i
;;
+ *)
+ ntp_ssl_libdir_search="$with_openssl_libdir"
esac
- AC_MSG_RESULT([$openssl_libdir])
- case "$openssl_libdir" in
- no)
- openssl_libdir=
- AC_MSG_WARN([libcrypto and libssl not found in any of $with_openssl_libdir])
+ for i in $ntp_ssl_libdir_search not_found
+ do
+ case "$host" in
+ *-*-darwin*)
+ test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
+ ;;
+ *)
+ test -f $i/libcrypto.so -a -f $i/libssl.so && break
+ test -f $i/libcrypto.a -a -f $i/libssl.a && break
+ ;;
+ esac
+ done
+ ntp_ssl_libdir=$i
+
+ AC_MSG_RESULT([$ntp_ssl_libdir])
+
+ case "$ntp_ssl_libdir" in
+ not_found)
+ ntp_ssl_libdir=
+ AC_MSG_WARN([libcrypto and libssl not found in any of $ntp_ssl_libdir_search])
esac
+ dnl ### set ntp_ssl_incdir ###
+
AC_MSG_CHECKING([for openssl include directory])
- with_openssl_incdir=${with_openssl_incdir-notgiven}
- case "$with_openssl_incdir" in
- notgiven)
- # Look in:
- with_openssl_incdir="/usr/include /usr/sfw/include"
- with_openssl_incdir="$with_openssl_incdir /usr/local/include"
- with_openssl_incdir="$with_openssl_incdir /usr/local/ssl/include"
- esac
+
case "$with_openssl_incdir" in
- no)
- ;;
- *) # look for openssl/evp.h:
- for i in $with_openssl_incdir no
- do
- test -f $i/openssl/evp.h && break
- done
- openssl_incdir=$i
+ '')
+ case "$ntp_ssl_incdir" in
+ '')
+ ntp_ssl_incdir_search="/usr/include /usr/sfw/include"
+ ntp_ssl_incdir_search="$ntp_ssl_incdir_search /usr/local/include"
+ ntp_ssl_incdir_search="$ntp_ssl_incdir_search /opt/local/include"
+ ntp_ssl_incdir_search="$ntp_ssl_incdir_search /usr/local/ssl/include"
+ ;;
+ *)
+ ntp_ssl_incdir_search="$ntp_ssl_incdir"
+ esac
;;
+ *)
+ ntp_ssl_incdir_search="$with_openssl_incdir"
esac
+ for i in $ntp_ssl_incdir_search not_found
+ do
+ test -f $i/openssl/evp.h && break
+ done
+ ntp_ssl_incdir=$i
AS_UNSET([i])
- AC_MSG_RESULT([$openssl_incdir])
- case "$openssl_incdir" in
- no)
- openssl_incdir=
- AC_MSG_WARN([did not find openssl/evp.h in any of $with_openssl_incdir])
+
+ AC_MSG_RESULT([$ntp_ssl_incdir])
+
+ case "$ntp_ssl_incdir" in
+ not_found)
+ ntp_ssl_incdir=
+ AC_MSG_WARN([did not find openssl/evp.h in any of $ntp_ssl_incdir_search])
esac
- if test -z "$openssl_libdir" -o -z "$openssl_incdir"
+ if test -z "$ntp_ssl_libdir" -o -z "$ntp_ssl_incdir"
then
ntp_openssl=no
else
ntp_openssl=yes
- VER_SUFFIX=o
+ ntp_ssl_cppflags="-I$ntp_ssl_incdir"
fi
- case "$ntp_openssl" in
- yes)
- # We have OpenSSL inc/lib dirs - use them.
- case "$openssl_incdir" in
- /usr/include)
- ;;
- *)
- CPPFLAGS_NTP="$CPPFLAGS_NTP -I$openssl_incdir"
- ;;
- esac
- case "$openssl_libdir" in
- /usr/lib)
+esac dnl building with SSL ($with_crypto not "no")
+
+case "$ntp_openssl" in
+ yes)
+ case "$ntp_ssl_libs_l" in
+ '')
+ ntp_ssl_libs_l="-lssl -lcrypto"
+ esac
+ CFLAGS="$NTPSSL_SAVED_CFLAGS $ntp_ssl_cflags"
+ CPPFLAGS="$NTPSSL_SAVED_CPPFLAGS $ntp_ssl_cppflags"
+ LIBS="$NTPSSL_SAVED_LIBS -L$ntp_ssl_libdir $ntp_ssl_libs_l"
+ LDFLAGS="$NTPSSL_SAVED_LDFLAGS $ntp_ssl_ldflags"
+ dnl test if runpath is needed for crypto
+ ntp_ssl_run_test_failed=no
+ AC_CACHE_CHECK(
+ [if SSL executable works without runpath],
+ [ntp_cv_ssl_without_runpath],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include "openssl/evp.h"
+ ]],
+ [[
+ if (!EVP_MD_CTX_new()) {
+ return 1;
+ }
+ ]]
+ )],
+ [ntp_cv_ssl_without_runpath=yes],
+ [ntp_cv_ssl_without_runpath=no],
+ [ntp_cv_ssl_without_runpath=yes] dnl cross-compile
+ )]
+ )
+ case "$ntp_cv_ssl_without_runpath" in
+ no)
+ AC_CACHE_CHECK(
+ [if SSL executable needs -Wl,-rpath,],
+ [ntp_cv_ssl_needs_dashWl_rpath],
+ [
+ LDFLAGS="$NTPSSL_SAVED_LDFLAGS $ntp_ssl_ldflags -Wl,-rpath,$ntp_ssl_libdir"
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include "openssl/evp.h"
+ ]],
+ [[
+ if (!EVP_MD_CTX_new()) {
+ return 1;
+ }
+ ]]
+ )],
+ [ntp_cv_ssl_needs_dashWl_rpath=yes],
+ [ntp_cv_ssl_needs_dashWl_rpath=no]
+ )
+ ]
+ )
+ case "$ntp_cv_ssl_needs_dashWl_rpath" in
+ yes)
+ ntp_ssl_ldflags="$ntp_ssl_ldflags -Wl,-rpath,$ntp_ssl_libdir"
;;
- *)
- LDADD_NTP="$LDADD_NTP -L$openssl_libdir"
- case "$need_dash_r" in
- 1)
- LDFLAGS_NTP="$LDFLAGS_NTP -R$openssl_libdir"
+ no)
+ AC_CACHE_CHECK(
+ [if SSL executable needs -R],
+ [ntp_cv_ssl_needs_dashR],
+ [
+ LDFLAGS="$NTPSSL_SAVED_LDFLAGS $ntp_ssl_ldflags -R$ntp_ssl_libdir"
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include "openssl/evp.h"
+ ]],
+ [[
+ if (!EVP_MD_CTX_new()) {
+ return 1;
+ }
+ ]]
+ )],
+ [ntp_cv_ssl_needs_dashR=yes],
+ [ntp_cv_ssl_needs_dashR=no]
+ )
+ ]
+ )
+ case "$ntp_cv_ssl_needs_dashR" in
+ yes)
+ ntp_ssl_ldflags="$ntp_ssl_ldflags -R$ntp_ssl_libdir"
esac
- case "$need_dash_Wlrpath" in
- 1)
- LDFLAGS_NTP="$LDFLAGS_NTP -Wl,-rpath,$openssl_libdir"
+ case "$build:$ntp_cv_ssl_needs_dashR" in
+ $host:no)
+ AC_MSG_FAILURE([Unable to run program using SSL])
esac
- ;;
esac
- LDADD_NTP="$LDADD_NTP -lcrypto"
esac
-esac
+esac dnl ntp_openssl was yes
-AC_MSG_CHECKING([if we will use crypto])
-AC_MSG_RESULT([$ntp_openssl])
-
-case "$ntp_openssl" in
- yes)
- AC_CHECK_HEADERS([openssl/cmac.h openssl/hmac.h])
- AC_DEFINE([OPENSSL], [], [Use OpenSSL?])
- case "$VER_SUFFIX" in
- *o*) ;;
- *) AC_MSG_ERROR([OPENSSL set but no 'o' in VER_SUFFIX!]) ;;
- esac
- ;;
-esac
-
-NTPO_SAVED_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $CPPFLAGS_NTP"
-NTPO_SAVED_LIBS="$LIBS"
+dnl AC_MSG_NOTICE([OpenSSL Phase II checks:])
+dnl AC_MSG_NOTICE([ntp_ssl_cppflags: $ntp_ssl_cppflags])
+dnl AC_MSG_NOTICE([ntp_ssl_cflags: $ntp_ssl_cflags])
+dnl AC_MSG_NOTICE([ntp_openssl_from_pkg_config: $ntp_openssl_from_pkg_config])
+dnl AC_MSG_NOTICE([ntp_ssl_incdir: $ntp_ssl_incdir])
+dnl AC_MSG_NOTICE([ntp_ssl_libdir: $ntp_ssl_libdir])
+dnl AC_MSG_NOTICE([ntp_ssl_libs_l: $ntp_ssl_libs_l])
+dnl AC_MSG_NOTICE([ntp_ssl_ldflags: $ntp_ssl_ldflags])
-#
-# check for linking with -lcrypto failure, and try -lcrypto -lz.
-# Helps m68k-atari-mint
-#
+dnl check for linking with -lcrypto failure, and try -lcrypto -lz.
+dnl Helps m68k-atari-mint
+dnl
+dnl Needs work with the changes to run-test whether runpath is needed.
+dnl Probably needs to be moved ahead of runpath testing.
+dnl hart@ is reaching out to MiNT users to try to find a tester.
+dnl Meanwhile can be forced by passing both ntp_cv_bare_lcrypto=no
+dnl and ntp_cv_lcrypto_lz=yes on the configure command line.
+dnl
case "$ntp_openssl:$ntp_openssl_from_pkg_config" in
yes:no)
- LIBS="$NTPO_SAVED_LIBS $LDADD_NTP"
+ CFLAGS="$NTPSSL_SAVED_CFLAGS $ntp_ssl_cflags"
+ CPPFLAGS="$NTPSSL_SAVED_CPPFLAGS $ntp_ssl_cppflags"
+ LIBS="$NTPSSL_SAVED_LIBS -L$ntp_ssl_libdir $ntp_ssl_libs_l"
+ LDFLAGS="$NTPSSL_SAVED_LDFLAGS $ntp_ssl_ldflags"
AC_CACHE_CHECK(
- [if linking with -lcrypto alone works],
+ [if linking with $ntp_ssl_libs_l alone works],
[ntp_cv_bare_lcrypto],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
- #include "openssl/err.h"
#include "openssl/evp.h"
]],
[[
- ERR_load_crypto_strings();
- OpenSSL_add_all_algorithms();
+ EVP_MD_CTX_new();
]]
)],
[ntp_cv_bare_lcrypto=yes],
)
case "$ntp_cv_bare_lcrypto" in
no)
- LIBS="$NTPO_SAVED_LIBS $LDADD_NTP -lz"
+ LIBS="$NTPSSL_SAVED_LIBS -L$ntp_ssl_libdir $ntp_ssl_libs -lz"
AC_CACHE_CHECK(
- [if linking with -lcrypto -lz works],
+ [if linking with $ntp_ssl_libs_l -lz works],
[ntp_cv_lcrypto_lz],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
- #include "openssl/err.h"
#include "openssl/evp.h"
]],
[[
- ERR_load_crypto_strings();
- OpenSSL_add_all_algorithms();
+ EVP_MD_CTX_new();
]]
)],
[ntp_cv_lcrypto_lz=yes],
)
case "$ntp_cv_lcrypto_lz" in
yes)
- LDADD_NTP="$LDADD_NTP -lz"
+ ntp_ssl_ldadd="$ntp_ssl_ldadd -lz"
esac
- esac
-esac
+ esac dnl linking with -lcrypto alone fails
+esac dnl using SSL and not from pkg-config
-#
-# Older OpenSSL headers have a number of callback prototypes inside
-# other function prototypes which trigger copious warnings with gcc's
-# -Wstrict-prototypes, which is included in -Wall.
-#
-# An example:
-#
-# int i2d_RSA_NET(const RSA *a, unsigned char **pp,
-# int (*cb)(), int sgckey);
-# ^^^^^^^^^^^
-#
-#
-#
+dnl
+dnl Older OpenSSL headers have a number of callback prototypes inside
+dnl other function prototypes which trigger copious warnings with gcc's
+dnl -Wstrict-prototypes, which is included in -Wall.
+dnl
+dnl An example:
+dnl
+dnl int i2d_RSA_NET(const RSA *a, unsigned char **pp,
+dnl int (*cb)(), int sgckey);
+dnl ^^^^^^^^^^^
+dnl
openssl_triggers_warnings=unknown
-NTPO_SAVED_CFLAGS="$CFLAGS"
-
case "$ntp_openssl:$GCC" in
yes:yes)
- CFLAGS="$CFLAGS -Werror"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- ]],
- [[
- /* see if -Werror breaks gcc */
- ]]
- )],
- [gcc_handles_Werror=yes],
- [gcc_handles_Werror=no]
+ CFLAGS="$NTP_SAVED_CFLAGS $ntp_ssl_cflags -Werror"
+ AC_CACHE_CHECK(
+ [If $CC supports -Werror],
+ [ntp_cv_gcc_supports_Werror],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [])],
+ [ntp_cv_gcc_supports_Werror=yes],
+ [ntp_cv_gcc_supports_Werror=no]
+ )]
)
- case "$gcc_handles_Werror" in
+ case "ntp_cv_gcc_supports_Werror" in
no)
- # if this gcc doesn't do -Werror go ahead and use
- # -Wstrict-prototypes.
- openssl_triggers_warnings=yes
+ ntp_use_Wstrict_prototypes=yes
;;
yes)
CFLAGS="$CFLAGS -Wstrict-prototypes"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include "openssl/asn1_mac.h"
- #include "openssl/bn.h"
- #include "openssl/err.h"
- #include "openssl/evp.h"
- #include "openssl/pem.h"
- #include "openssl/rand.h"
- #include "openssl/x509v3.h"
- ]],
- [[
- /* empty body */
- ]]
- )],
- [openssl_triggers_warnings=no],
- [openssl_triggers_warnings=yes]
+ AC_CACHE_CHECK(
+ [if OpenSSL triggers warnings],
+ [ntp_cv_ssl_triggers_warnings],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include "openssl/asn1_mac.h"
+ #include "openssl/bn.h"
+ #include "openssl/err.h"
+ #include "openssl/evp.h"
+ #include "openssl/pem.h"
+ #include "openssl/rand.h"
+ #include "openssl/x509v3.h"
+ ]],
+ [[
+ /* empty body */
+ ]]
+ )],
+ [ntp_cv_ssl_triggers_warnings=no],
+ [ntp_cv_ssl_triggers_warnings=yes]
+ )]
)
+ case "$ntp_cv_ssl_triggers_warnings" in
+ yes)
+ ntp_use_Wstrict_prototypes=no
+ ;;
+ *)
+ ntp_use_Wstrict_prototypes=yes
+ esac
esac
- case "$openssl_triggers_warnings" in
- yes)
- CFLAGS_NTP="$CFLAGS_NTP -Wno-strict-prototypes"
+ case "$ntp_use_Wstrict_prototypes" in
+ no)
+ ntp_ssl_cflags="$ntp_ssl_cflags -Wno-strict-prototypes"
;;
*)
- CFLAGS_NTP="$CFLAGS_NTP -Wstrict-prototypes"
+ ntp_ssl_cflags="$ntp_ssl_cflags -Wstrict-prototypes"
esac
;;
no:yes)
- # gcc without OpenSSL
- CFLAGS_NTP="$CFLAGS_NTP -Wstrict-prototypes"
-esac
+ dnl gcc without OpenSSL
+ ntp_ssl_cflags="$ntp_ssl_cflags -Wstrict-prototypes"
+esac dnl checking for gcc problems with -Werror and -Wstrict-prototypes
-# Because we don't want -Werror for the EVP_MD_do_all_sorted check
-CFLAGS="$NTPO_SAVED_CFLAGS"
+AC_MSG_CHECKING([if we will use crypto])
+AC_MSG_RESULT([$ntp_openssl])
case "$ntp_openssl" in
yes)
- LIBS="$NTPO_SAVED_LIBS $LDADD_NTP"
+ VER_SUFFIX=o
+ AC_CHECK_HEADERS([openssl/cmac.h openssl/hmac.h])
+ AC_DEFINE([OPENSSL], [], [Use OpenSSL?])
+ dnl We don't want -Werror for the EVP_MD_do_all_sorted check
+ CFLAGS="$NTPSSL_SAVED_CFLAGS"
AC_CHECK_FUNCS([EVP_MD_do_all_sorted])
- ;;
+ CPPFLAGS_NTP="$CPPFLAGS_NTP $ntp_ssl_cppflags"
+ CFLAGS_NTP="$CFLAGS_NTP $ntp_ssl_cflags"
+ LDADD_NTP="$LDADD_NTP -L$ntp_ssl_libdir $ntp_ssl_libs_l $ntp_ssl_ldadd"
+ LDFLAGS_NTP="$LDFLAGS_NTP $ntp_ssl_ldflags"
esac
dnl AC_MSG_NOTICE([OpenSSL final checks:])
+dnl AC_MSG_NOTICE([ntp_openssl: $ntp_openssl])
dnl AC_MSG_NOTICE([CPPFLAGS_NTP: $CPPFLAGS_NTP])
dnl AC_MSG_NOTICE([CFLAGS_NTP: $CFLAGS_NTP])
dnl AC_MSG_NOTICE([LDADD_NTP: $LDADD_NTP])
dnl AC_MSG_NOTICE([LDFLAGS_NTP: $LDFLAGS_NTP])
-CPPFLAGS="$NTPO_SAVED_CPPFLAGS"
-LIBS="$NTPO_SAVED_LIBS"
-AS_UNSET([NTPO_SAVED_CFLAGS])
-AS_UNSET([NTPO_SAVED_CPPFLAGS])
-AS_UNSET([NTPO_SAVED_LIBS])
-AS_UNSET([openssl_triggers_warnings])
+CFLAGS="$NTPSSL_SAVED_CFLAGS"
+CPPFLAGS="$NTPSSL_SAVED_CPPFLAGS"
+LIBS="$NTPSSL_SAVED_LIBS"
+LDFLAGS="$NTPSSL_SAVED_LDFLAGS"
+
+AS_UNSET([pkg])
+AS_UNSET([NTPSSL_SAVED_CFLAGS])
+AS_UNSET([NTPSSL_SAVED_CPPFLAGS])
+AS_UNSET([NTPSSL_SAVED_LIBS])
+AS_UNSET([ntp_use_Wstrict_prototypes])
AS_UNSET([ntp_openssl_from_pkg_config])
+AS_UNSET([ntp_openssl_version])
+AS_UNSET([ntp_ssl_cflags])
+AS_UNSET([ntp_ssl_libdir_search])
+AS_UNSET([ntp_ssl_incdir_search])
+AS_UNSET([ntp_ssl_libdir])
+AS_UNSET([ntp_ssl_incdir])
+AS_UNSET([ntp_ssl_libs_l])
+AS_UNSET([ntp_ssl_ldflags])
+AS_UNSET([ntp_ssl_run_test_failed])
+AS_UNSET([ntp_ssl_with_dashR])
+
])
+dnl end of AC_DEFUN([NTP_OPENSSL])
dnl ======================================================================