1
dnl ######################################################################
2
dnl OpenSSL support shared by top-level and sntp/configure.ac
3
AC_DEFUN([NTP_OPENSSL], [
9
AC_MSG_CHECKING([for openssl library directory])
10
AC_ARG_WITH(openssl-libdir,
11
AC_HELP_STRING([--with-openssl-libdir], [+ =/something/reasonable]),
20
ans="/usr/lib /usr/lib/openssl /usr/sfw/lib /usr/local/lib /usr/local/ssl/lib /lib"
22
*) # Look where they said
27
*) # Look for libcrypto.a and libssl.a:
32
test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
35
test -f $i/libcrypto.so -a -f $i/libssl.so && break
36
test -f $i/libcrypto.a -a -f $i/libssl.a && break
53
AC_MSG_CHECKING([for openssl include directory])
54
AC_ARG_WITH(openssl-incdir,
55
AC_HELP_STRING([--with-openssl-incdir], [+ =/something/reasonable]),
64
ans="/usr/include /usr/sfw/include /usr/local/include /usr/local/ssl/include"
66
*) # Look where they said
71
*) # look for openssl/opensslconf.h:
74
test -f $i/openssl/opensslconf.h && break
89
AC_MSG_CHECKING([if we will use crypto])
91
AC_HELP_STRING([--with-crypto], [+ =openssl]),
92
[ans=$withval], [ans=yes])
97
if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC"
105
AC_MSG_RESULT([$ans])
107
case "$ntp_openssl" in
109
# We have OpenSSL inc/lib - use them.
110
CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
111
LDFLAGS="$LDFLAGS -L$OPENSSL_LIB"
112
case "$need_dash_r" in
113
1) LDFLAGS="$LDFLAGS -R$OPENSSL_LIB"
115
AC_SUBST(LCRYPTO, [-lcrypto])
116
AC_DEFINE(OPENSSL, , [Use OpenSSL?])
120
# Older OpenSSL headers have a number of callback prototypes inside
121
# other function prototypes which trigger copious warnings with gcc's
122
# -Wstrict-prototypes, which is included in -Wall.
126
# int i2d_RSA_NET(const RSA *a, unsigned char **pp,
127
# int (*cb)(), int sgckey);
132
openssl_triggers_warnings=unknown
133
SAVED_CFLAGS="$CFLAGS"
135
case "$GCC$ntp_openssl" in
137
CFLAGS="$CFLAGS -Werror"
139
AC_LANG_SOURCE([[ /* see if -Werror breaks gcc */ ]]),
140
[gcc_handles_Werror=yes],
141
[gcc_handles_Werror=no]
143
case "$gcc_handles_Werror" in
145
# if this gcc doesn't do -Werror go ahead and use
146
# -Wstrict-prototypes.
147
openssl_triggers_warnings=yes
150
CFLAGS="$CFLAGS -Wstrict-prototypes"
154
#include "openssl/asn1_mac.h"
155
#include "openssl/bn.h"
156
#include "openssl/err.h"
157
#include "openssl/evp.h"
158
#include "openssl/pem.h"
159
#include "openssl/rand.h"
160
#include "openssl/x509v3.h"
162
[[ /* empty body */ ]]
164
[openssl_triggers_warnings=no],
165
[openssl_triggers_warnings=yes]
168
case "$openssl_triggers_warnings" in
170
CFLAGS="$SAVED_CFLAGS -Wno-strict-prototypes"
173
CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes"
177
# gcc without OpenSSL
178
CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes"
182
dnl ======================================================================